NYCPHP Meetup

NYPHP.org

[nycphp-talk] [OT] Javascript form question

Tom Melendez tom at supertom.com
Sun Aug 15 10:29:33 EDT 2004


Hey Folks,

I have a javascript issue that I'm about to get into, and I just wanted to run it by you guys to see if anyone has solved this before, 
or perhaps has a good idea about approaching it.

I have a standard looking interface with left bar navigation and the "meat" (forms) in the middle.  What I need to do is the following:

If the user makes any changes to the form, and then clicks somewhere on the left nav bar without first clicking 
the "save" (or cancel) button at the bottom, I need them to confirm that they'd like to discard or save their changes and 
leave that page.

I don't believe the actions that will occur afterwards will be a problem, but I'm not quite positive on how to implement the form check 
in the first place.  I would like it be "general", so that it is not dependent on the elements in the form, but rather the form as a
whole.  I was thinking that I could perhaps, when building the page, create a "dynamic" JS function that had all the existing values, and
then on unLoad, check them against the current values.  Or, maybe I could create a form object, and just do a simple comparison against
the current form object - I'm not sure about that one.

Any thoughts or comments are greatly appreciated.

Thanks,

Tom
www.liphp.org




More information about the talk mailing list