You need to sign in to do that
Don't have an account?
Maddy6161
Hi! I want to create a VF form where i retrieve all account name in drop down field, when i select any account name then the relate field will be shown?? is it possible ?? or any code for that
Account : Maddy - drop-down filed when i selected Maddy i want to retrive Fax, Phone, Website fields will be showned automatically
Fax: ______________ these field automatically come when i select account name from dropdown
Phone:_____________
Wesite:_____________
Fax: ______________ these field automatically come when i select account name from dropdown
Phone:_____________
Wesite:_____________
Please find the following solution -
Controller Class:
Visualforce Page: (Give some Name like 'AccountInfo')
------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
controller:
Vf page:
Please mark as best answer if it solved your problem.
Apex:
VF:
Mark it as Best Answer, if it helps.
thanks Srinivasa Reddy S,Anil kumar Gorantala
Controller Class -
Visualforce Page -
------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
Thaks for letting me know that it is not working.
I have found following issues -
1. Forgot to call 'Save' action from CommandButton.
2. For some reason inputFields are not rerendering, while troubleshooting I have figured out that -
- Page is displaying only few inputfields, few fields on the account are not displaying those fields might be the mandatory fields.
- Due to this reason inputfields are not rerendering.
- To resolve this issues, while invoking method through unchange event inputFields should not be processed at server side.
- I wrapper selectlist in 'actionregion', this resolve the issue of rerendering of inputfields
Finally, everything working well, please let me know if you have any more suggestions.Controller Class -
Visualforce Page -
------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
Thanks,
Srinivas
Here's an example of how you can accomplish this:
Create a Visualforce page: Create an Apex controller (AccountController) to handle the logic:
In this example, the Visualforce page uses the apex:selectList component to display a dropdown list of account names. The apex:actionSupport component triggers an action in the Apex controller when the selected value changes.
The getAccountOptions method in the Apex controller retrieves the account names and populates the dropdown list.
The getRelatedFields method is invoked when the selected account changes. It fetches the related fields from the selected account and assigns them to variables. The rendered attribute is used to conditionally display the related fields section based on whether an account is selected.
You can customize the Visualforce page and Apex controller code according to your specific requirements, including adding more related fields and modifying the query to fetch the account data.
Note: Make sure to handle error scenarios, such as when an account is not found or when there are no related fields available for a selected account. Source https://fiverrme.com/