+ Start a Discussion
shashi kanaparthishashi kanaparthi 

Maintaining data in the Visualforce Page form after Save


I have a form which opens up on click of a custom button "Generate Service" on opportunity. After the form is Saved, the user is redirected to the opportunity detail page. When the Button "Generate Service" is clicked again, I want the old form which was saved before to open up again instead of the brand new form. Let me know if this can be done.
Hi Shashi,

This can be achieved in many ways. Basic option is to use a checkbox. Below are the steps that you can follow.

1. Createa check box (is Generate Service completed)
2. Have two sections in the VF Page (one with rendered attribute as checkbox == true and another with checkbox == false)
3. if check box is true which means that the details has been updated. Under the Checkbox == true status, add all the fields using outputfield.
4. if the check box is fale which means that the details has not been updated. add all the fields using input field under this section.
5. In save method write a logic to update the values along with the checkbox = true.

Let me know if you need more help.

Mark this as answer if it really help you solve your problem.

Manoj S

shashi kanaparthishashi kanaparthi
Hi Manoj,

I need to reatain the input field values in the form after I save the form and reopen it. The approach you had suggested would work only if I want to open the form in read only mode. 

Let me know if there is way to retain the input values in a form after the save.