You need to sign in to do that
Don't have an account?
apex:actionSupport onchange event, not passing latest values to controller using apex:param
Hi All,
I am using on <apex:actionSupport> on an InputField, and on change of field value, i am passing InputField value to controller using <apex:param>. However the issue is, in controller, iam not getting latest InputField value. Please see below simpler code snippet:
VF page:
<apex:page controller="testcontroller">
<apex:form >
<apex:inputField value="{!acct.name}" >
<apex:actionSupport event="onchange" action="{!setvar}" reRender="">
<apex:param name="setvar" value="{!acct.name}" assignTo="{!var}"/>
</apex:actionSupport>
</apex:inputField>
</apex:form>
</apex:page>
Controller:
public class testcontroller{
public String Account { get; set; }
public Account acct{get;set;}
public string var{get;set;}
public testcontroller(){
acct = new Account();
}
public void setvar(){
system.debug('var#####'+var);
}
}
Please help me out, if there is any other way to pass this latest field value on change to Controller.
Thanks
As you are using "acct" get set variable already, you don't have to use one more variable. you can directly use acct.Name in the method. Modify your code as mentioned below.
Try this and let me know if you need more help.
Regards
Naveen