PDA

View Full Version : FormPanel state, standardSubmit and browser history



VanillaBean
4 Feb 2010, 12:15 AM
I use Ext.form.FormPanel to render a form containing several form widgets, configured to use standardSubmit:true and a submit button handler. Using standardSubmit because I need to integrate with an existing site to process the results of the submitted form.

When the page containing this form is navigated away from (by clicking submit), and then gets navigated back to again using browser history, the state of all of the widgets is lost (selections in combos, values in text boxes, checkboxes, etc). I can see Ext.onReady() being called in Firebug when this happens, and that the DOM looks like it does for a fresh GET of the page. I've also confirmed that a request is **not** being made back to the server for the page.

I'd like to return the page to the same state it was in when it was navigated away from. What can I do to maintain this state?

I'm not really clear on what actually is "cached" by the browser when a page has its DOM dynamically altered, and is navigated away from. I was hoping it was the state of the DOM when it was navigated away from, but it looks as if its the state of the DOM when the page was first loaded.

I'm thinking the way to solve this is to insert a url into the browser history that includes the necessary form values...

I'd appreciate any help or insight.

Thanks



Ext.onReady(function(){

var fp = new Ext.form.FormPanel({
id : 'fp',
standardSubmit : true,
renderTo : Ext.get('panel'),
width : 700,
frame : true,
defaultType : 'textfield',
defaults : {anchor: '-20'},
items : [{name:'test', id:'v'}],
buttonAlign : 'center',
buttons : [{text : "Submit",
type : 'submit',
scope : this,
handler : function(){
var fp = Ext.getCmp('fp');
fp.getForm().getEl().dom.method = "GET";
fp.getForm().getEl().dom.action = "/test.html";
fp.getForm().submit();
}
} // eo submit button
]
}); //eo FormPanel

}); // eo onReady