I'm not sure there's any especially good way... the methods I can think of all require scripting of some sort. If that is OK though...

First, I would store the original value in some way, preferably as part of the form element... I assume your using the HTML taglib, so one candidate might be to use the alt attribute... if you aren't using tht HTML taglib, you can simply set some arbitrary attribute of the element, that works great... then, use EL to populate the alt attribute (or your own attribute) with the value of the field.

Alternatively, render some Javascript that stores the values in an associative array. This would work regardless of the taglib you use, if any.

Then, I would create a Javascript function which is called when your form is submitted... this function would go through all the elements of your form and compare their current values to their original values. If any don't match, your data is "dirty", and you need to save.

Another method is to include an onChange event handler for every element in your form that sets a flag to indicate the data is "dirty". Then you just check that flag on submit. The problem with this is it isn't guaranteed accurate... if the user alters a field, then re-enters the original value, it'll still be flagged as "dirty" data. I've done this frankly, and it is usually OK with people, but not always.

Kumar, Sandy wrote:
All,
I have a page with 3 tabs. If user goes to any of the pages, and does
not alter the value he entered before, I should not submit the form.
How can I check whether jsp form elements have changed or not?. Thanks,
Sandy Kumar


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to