You need to sign in to do that
Don't have an account?
Tyler Harris 8
Pass clicked link to Apex variable?
Hello all,
I have a link that I want passed to a String Variable in the Controller onclick. I'm failing at accomplishing this. Any help would be useful.
Visualforce
Apex
I have a link that I want passed to a String Variable in the Controller onclick. I'm failing at accomplishing this. Any help would be useful.
Visualforce
<apex:form > <apex:actionRegion > <apex:actionFunction name="setLink" action="{!makeLink}" reRender="link"> <apex:param name="param1" assignTo="{!setLink}" value="" /> </apex:actionFunction> </apex:actionRegion> </apex:form> <a id="downloadContent" href="{!$Site.Prefix}/sfc/servlet.shepherd/version/download/{!con.Id}" onclick="setLink()"><i class="fa fa-download"></i></a>
Apex
public String linkClick{ get;set; } public PageReference makeLink(){ return null; }
<a id="downloadContent" href="{!$Site.Prefix}/sfc/servlet.shepherd/version/download/{!con.Id}"onclick="setLink(this.href)"><i class="fa fa-download"></i></a>