You need to sign in to do that
Don't have an account?
sumit d
action function in visualforce
hi all,
i want to create a visualforce page using Action Function in which we have two drop down lists( Country and State). when i select a country from drop down it should automatically shows the states of that country in other dropdown list automatically without reloading a page .(like AJAX).
any suggestion?
Regards
Amit
i want to create a visualforce page using Action Function in which we have two drop down lists( Country and State). when i select a country from drop down it should automatically shows the states of that country in other dropdown list automatically without reloading a page .(like AJAX).
any suggestion?
Regards
Amit
You can achieve your requirement using following process:
1) Custom Setting
2) Action Function
1) Custom Setting: Please refer this https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_custom_settings.htm
2) Action Function: Ajay give you best example for this, but in Apex Function you have to create Global picklist OR country and state picklist for each obejct with all country and state values. If you will create custom setting then no need to create country and state picklist for each object with all values.
Custom setting is best way to achieve country and state values.
Hope this will help you. Let me know if it helped or you need any more assistance.
Please mark this is as the solution if it solved your purpose.
Thanks,
Sohan Raj Gupta
All Answers
Please refer the below code snippet hope it helps you write your code.
Action Function
actionfunction component provides support for invoking controller action methods directly from JavaScript code using an AJAX request.
It is different from actionsupport which only provides support for invoking controller action methods from other Visualforce components, actionfunction defines a new JavaScript function which can then be called from JavaScript code.
In the example below, we are showing one picklist with name customer priority. Whenever we will change customer, then javascript method will be called. And we have specified corresponding controller action method in actionfunction component method. In controller method we are checking if customer priority is high then we are setting the boolean variable as true. So phone textbox will be rendered automatically without refreshing full page
Visualforce Code:
Please select as best answer if it helps you.
Thank You,
Ajay Dubedi
You can achieve your requirement using following process:
1) Custom Setting
2) Action Function
1) Custom Setting: Please refer this https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_custom_settings.htm
2) Action Function: Ajay give you best example for this, but in Apex Function you have to create Global picklist OR country and state picklist for each obejct with all country and state values. If you will create custom setting then no need to create country and state picklist for each object with all values.
Custom setting is best way to achieve country and state values.
Hope this will help you. Let me know if it helped or you need any more assistance.
Please mark this is as the solution if it solved your purpose.
Thanks,
Sohan Raj Gupta