PDA

View Full Version : How to reset form values after cliking back button



vvorobeychik
18 Aug 2009, 10:15 AM
I have a form (FormPanel) where I enter a number of values. There is a "Next" button on the form which navigates me to another page. If I click the browser's back button all entered values are lost. How to reset the enterd values? Please, help.

I tried to declare a global variable and use myForm.getForm().getValues(); on the first page. It worked, but after the return from the second page the object is lost. The main form's properties are listed below:
<code>
var myForm= new Ext.FormPanel({
frame : true,
standardSubmit: true,
defaults:{align:'center'},
title : 'Reservation Form',
bodyStyle : 'padding:5px 5px 0',
trackResetOnLoad:true,
labelWidth:110,width:660 ...

</code>

vvorobeychik
18 Aug 2009, 11:52 AM
Solved by myself.
I created a HTML form and a hidden <input> control in it.
I used
document.frmHidden.formValues.value = Ext.encode(myFrm.getForm().getValues());

on the return on the first page I used
var obVal = Ext.decode(document.frmHidden.formValues.value);
myFrm.getForm().setValues(obVal);