PDA

View Full Version : Remember form field values



devtig
12 Feb 2010, 3:05 AM
I have a form with about 20 fields. I need the value state of each field remembered so that when someone half completes the form, then starts navigating away and comes back to the form the entered fields would be prefilled from saved state.

Can't find clear examples. I tried something what Saki did to save an accordion state, but I can't find a way of making it work on my form.



var frmMember=new Ext.form.FormPanel({
monitorValid:true,
labelAlign: 'top',
frame:true,
header: false,
title: 'Registratieformulier',
renderTo: 'divContentMid',
width: 558,
defaults: {
stateful: true,
stateEvents: ['change'],
getState:function() {
return {value:this.value};
}
},
items: [...20 textfields...],
buttons: []
}
:">

realjax
12 Feb 2010, 5:42 AM
Put a listener on the event that notifies the user navigating away and a listener on arriving at the form. When navigating away, have the listener copy all values to a new record, and on arriving back load that record into the form, then destroy the record.