Ok, i have hacked my way around ExtJS in the past but google and the forum search function are just not aiding me with this. I'm sure the answer is obvious but i'm still at a loss. Any help or suggestions would be appreciated.
I have a grid, when you select a row and click edit, a window pops up with a form panel, the record is loaded into the form panel, and when you click save, it updates the database record and reloads the datastore attached to the grid.
The window object, as well as the form object are declared first and then used above.
All is well.
However, now i wanna use the same form panel to pop up when i click an add button to create a new record. However, when i click the add button and bring up the form panel, it is already filled out with the previous data that i edited before.
Searches in the forum and google on how to clear a form didnt give me much, i found a function that you can use as a plugin that adds a "clear" function, but once i use that, all the fields come up red with failed validations.
What is the best way to do this?
Here is some snippets of my code:
Just the beginning, and then i use the form in this window:Code:var editaddpanel = new Ext.FormPanel({ labelWidth:80, url:'update.php', id: 'customer-form', frame:true, title:'edit/add', defaultType:'textfield', monitorValid:true, ....
So what is the best way to reuse a form panel object? or clear a form? or am i going about this wrong.Code:var win = new Ext.Window({ layout:'fit', width:550, height:380, closable: false, resizable: false, plain: true, border: false, items: [editaddpanel] });