Hello everyone,
I m using Popups API to open a webform from a link.
You can still see the original webform with three ways:
- Type the url of the webform in the browser's address bar. The url appears when you hover the link in the browser's status bar.
- Middle click the link and open the webform in a new tab.
- Right click the link and "Open link in new tab" or "Open link in new window".
I want the webform to be accessible only via the popup, that is only by left clicking on the link.
The first thought was to add the class="popups" to the url alias of the webform something like:
webform/class="popups"
So, when you type "www.domain-name.com/webform" in the address bar it will open the form via popup directly.
Is there anyway to pass class to a url alias?
The second thought was to set the href without target, so that the url is not visible and open the webform with onclick attribute something like:
<a href="#" OnClick="location.href='webform';"> or
<a href="javascript:void(0);" OnClick="location.href='webform';">
In this case redirection works but I can t pass the class="popups" to the attribute in order to open the link with popups.
Any ideas if this is possible?
Thank you for your time.
Best regards
John
Comments
Comment #0.0
mponiek commentedspelling check
Comment #1
mponiek commentedComment #2
mponiek commentedOK
Here is a solution. Maybe not the best way to do it but it is working.
Instead of using
<a class="webform-popup" href="/webform" >popup webform</a>we can replace it with the
and add in script.js file the following function:
NOTE:If you want to use the class "webform-popup" read this article or replace it with the class "popups".
In this way:
- if user hovers the link "popup webform" in the browser's status bar appears "javascript:void(0);"
- middle click the link "popup webform" opens a blank tab (Opera) or the same tab (Firefox) or the popup window like the left click (Chrome, Safari, IE)
- right click the link "popup webform" copies the link "javascript:void(0);"
You can use it in tpl.php files without any problem.
There is one problem with this solution.
If you write this in a node using CKEditor (I suppose and in other WYSIWYG editors) you have to use "Source" button of CKEditor. After this you MUST NOT click "Source" button again because CKEditor will remove the empty link and instead of:
your code will be:
<a href="javascript:void(0);" onClick="pop()">popup webform</a>and nothing will happen when you click in this link.
So, you have to write it last and save the node with the CKEditor in "Source" mode or disable CKEditor for this node. I prefer the second one because this will happen everytime you edit that node.
I hope that this will help.
Thank you for your time.
Best regards
John
Comment #2.0
mponiek commentedspelling check