In your button handler you can get values from form with getValues()
method and then store values into cookies with Ext.state.Manager.set()
method.
handler : function(btn){
var form = btn.up('form');
var values = form.getValues();
Ext.state.Manager.set('formFieldValues', values);
}
Restore form state from cookies you can in listener for form afterrender
event. For getting form state from cookie you can use Ext.state.Manager.get()
method.
listeners: {
afterrender: function(form) {
var values = Ext.state.Manager.get('formFieldValues');
if (values) {
console.log(values);
Ext.Object.each(values, function(key, value) {
form.count += 1;
form.add({
xtype: 'textfield',
name: 'field' + form.count,
fieldLabel: 'field ' + form.count,
value: value
});
});
}
}
}
Fiddle with complete example: https://fiddle.sencha.com/#fiddle/32e