0

I have a requirement where there is a checkbox which on being checked, rerender the whole VF and then pageblocks are hidden and become visible based on the checkbox. So for example I have a pagblock1 and pagblock2, when that checkbox is checked, then pagblock1 is hidden and pagblock2 is visible. -- This is working perfectly.

However, when pagblock2 is visible I have some inputfield of VF. For example I have a outputlabel "Time Period" and inputfield which is a picklist. picklist has 2 options, latest and between. when between is selected, I have to show 2 input fields, which should be rendered. But this is not at all working. However, when I submit the VF page and validations run (custom validation) and then I select between both these input fields are visible.

Apologies as I cannot post any code.

1 Answer 1

1

Visualforce uses a "view state" to remember the value of variables stored in a controller or extension. If you set a value to a field, even one that is not rendered on the screen, it will remain set as long as the view state is maintained. You will need to write code to clear out those fields when you hide those fields.

1
  • Thanks @sfdcfox for your revert, however the fields which are hidden even if they have value, is not showing on the screen and there is no manipulation. Now, those fields which are visible after checkbox is checked, time period operator field is visible then. Time operator has 2 options, latest and between. Now when I select "between" then I am asking VF to show two new input fields on the page. So I guess view state didn't had any inputs already for the time operator field. Dec 5, 2023 at 8:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .