You need to sign in to do that
Don't have an account?
Meer Salman
Setting property from VFPage
Hi,
I have a Controller in which i have a property as following:
public class test
{
public string mystr {get; set;}
}
I have a VFPage for this controller now I want to set the property on the click event of outputlink how can I set the property? I know how to get the value fromt he property but I am a bit confuse in setting a property via VFPage.
<apex:page controller = 'test'>
<apex:form>
<apex:outputlink value="xyz" onclick???>Meer</outputlink>
</apex:form>
</apex:page>
Regards,
Meer Salman
try like this. u need to replace the value in param tag...
<apex:page controller = "test">
<apex:form>
<apex:outputlink value="xyz">Meer
<apex:param assignTo="{!mystr}" value="need to fill the respective property"/>
</outputlink>
</apex:form>
</apex:page>
All Answers
try like this. u need to replace the value in param tag...
<apex:page controller = "test">
<apex:form>
<apex:outputlink value="xyz">Meer
<apex:param assignTo="{!mystr}" value="need to fill the respective property"/>
</outputlink>
</apex:form>
</apex:page>
Hi,
Try the below code snippet as reference:
--------------- Vf page-----------------
<apex:page controller="test">
<script>
function chkfun(val)
{
alert(val.href);
assignvalue(val.href);
}
</script>
<apex:form >
<apex:outputLink value="http://google.com" onclick="chkfun(this)" >abc </Apex:outputLink>
<apex:actionFunction name="assignvalue" action="{!getvalue}"><apex:param value="" assignTo="{!mystr}" name="assignvalue"/> </apex:actionFunction>
</apex:form>
</apex:page>
------------- Apex controller-------------
public class test
{
public string mystr{get; set;}
public void getvalue()
{
system.debug('##################'+mystr);
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.