You need to sign in to do that
Don't have an account?
EIE50
Basic question on Javascript in apex:commandlink
Hi,
I would like to use a javascript function to email the url, and i am just wondering how can i call the java script function using apex:commandlink?Can anyone help me with this? The below way of passing the javascript doesnt work, the link is just static when clicked, no action is occuring.
<apex:commandLink style="float:right" onclick="{!$Resource.EmailLink}" value="EmailLink"/>
i am posting my Javascript here:
function EmailLink(){ window.location = "mailto:"+"?subject=I thought this link might interest you." + "&body="+document.title+" "+window.location; }
You would have to include the javascript on the page before calling it.
This should call the javascript function EmailLink().
All Answers
You would have to include the javascript on the page before calling it.
This should call the javascript function EmailLink().
Hi,
your solution did work, but whenever i click on the email link the page refreshes and i dont want it to happen. Since i did not specify action attribute, the page is getting refreshed, What am i suppose to write in the code (apex), so that the page does not refresh everytime when i click email link.
Thanks.
Did you try returning null and have reuturn type as pagereference?
Hi,
I tried the following code.
and in VF page:
Was i wrong?
Thanks.
Maybe you should not use apex:commandLink, but create the link manually with <a onclick="...">linkText</a>
commandlink will always refresh unless you specify the rerender attribute. Not sure if you could point the reRender to something insignificant and thus avoid the reload
Thanks, i used <a>tag and specified required attributes in it and this works fine now.