PDA

View Full Version : Remembering form fields on a button click



aghextjs
18 Nov 2010, 8:34 AM
I have a FormPanel with a few text fields and combo boxes. I want to remember the form field values when a button on the FormPanel is clicked. I am using a state provider and I currently have it working, but the state events I am currently using are things like "change" or "blur" on the fields. But what I really want is to set the state when the button is clicked.

And now I'm confusing myself about events.

How do I get the form fields to know about the button click on the formPanel? Or am I approaching this backwards? Should I be setting stateful:true on the formPanel and not the individual form fields and handling getState and applyState on the formPanel?

Thanks for any advice, tips or getting me straightened out on events.

Annie

matt617
18 Nov 2010, 9:49 AM
state is a great way to manage forms but may be overkill for what your trying to do. do you need to use a form button or will any button do? you can attach a listener anywhere to then go check the form and submit. how big is this form? do you do a lot of validation? if its a big form with validation state may be the long term better solution

Screamy
18 Nov 2010, 9:58 AM
And in case you're using a CookieProvider for state management, be aware that you'll run into an HTTP request header length limit if your app starts storing too much state info via Cookies...

aghextjs
18 Nov 2010, 10:53 AM
A few things, this is only to remember 5 fields. It has nothing to do w/submitting, but more with remembering values for back button handling when moving in and out of pages using Ext JS. Also, I am not using the CookieProvider, but my own provider that only remembers data during the session.

I think I'm confused on a basic thing. I want the children items (the form fields) to know about an event on the parent, the form. But for some reason I don't quite get how to actually implement that. I've added events to extended classes and have handled those events, but in this case I think I am going the opposite direction... If that makes sense.

aghextjs
18 Nov 2010, 11:13 AM
I think I just made some progress.... I am now trying to relay an event from the formpanel to the individual fields.