Announcement Announcement Module
Collapse
No announcement yet.
Detecting if form input fields have been edited Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Detecting if form input fields have been edited

    Hello.

    In our project we are using the spring framework and I are quite happy about our choice. Everything works fine but there is one question and I am wondering if anyone knows an answer to the following:

    Is there a way to make our application notice if the user edited the fields of an input form? For e.g. we have an input form with about 5 input fields which is bound to a related object. Is it possible to tell our application that there is/was an edit?

    Thank you very much for your anticipation.

    Wolfgang

  • #2
    One way is obviously to take a snapshot of the form object before showing the form, then compare it field by field with the form object binded from the form submission.

    Another way is to have some javascript on the client side listening to appropriate events (e.g. onchange), and setting a hidden field if it detects any changes.

    Comment


    • #3
      We use the latter approach (JavaScript). Please note that there are some catches or the JavaScript thinks the page has been changed, for example I believe your dropdown fields must have default values (we make sure this is the case by embedding this in a velocity macro for a select input field that takes the first value as default if there is no other default).

      Comment

      Working...
      X