function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
skdevskdev 

dynamically display field in visual force

Hi

 

i have a visual force page when a particular value in a lookup is selected want to display another field on the page

how can i do that?

 

Thanks

Skdev

Imran MohammedImran Mohammed

First thing, You should already add the field you want to display dynamically to the Vf page but the rendered attribute should be false.

 

There should be a variable declared in the controller thats used in the Visualforce page for lookup.

So you should have a onblur event that will check whenever the control comes out of lookup field.

The onblur event should invoke action of a Controller class.

In the controller class, you should check whether the lookup variable is null. If it is null then you should rerender the field that you want to display in VF page. In this case the rendered attribute of the field you want to display should be true.

 

Let me know if you have any questions.

 

 

 

skdevskdev
Can you please post a sample on how to call a controller method in an onblur event. I guess am getting mixed up with javascript and apex code, sorry newbie here :). Hopefully a sample will clear my confusion.