• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to know the values displayed values changed or not in a jsp for update purpose

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
i have question here right now iam working with a jsp page if user change some displayed vales in text boxes and he can press "UPDATE" button to update the values how come i know which fields were changed by user if nothing was changed and presses the "UPDATE" button i have to display an alert that "NO CHANGES WAS MADE IN THIS PAGE".
YOU GUYS MAY HELP ME.
thanks
giri shetty
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a job for Javascript to me (since you are doing this on the client side). As such, remanding to the HTML/Javascript forum.
[ February 27, 2004: Message edited by: Bear Bibeault ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay there are to ways to do it...
ONE - When the page loads have JavaScript loop through the form array and store the vales of every element. When the submit button is pressed then it compares all the valus and looks for any changes....
This way can take some time depending on the number of elements the form has.
TWO - add an onchange event to every element that basically tells the script if the value has changed. This will not require any start time nor end time. I would go with this if it is not too hard to add an attribute:
onchange="allowSubmit=true"
to all of your form elements.
the script would be

the form tag would be
<forn name="blah" onsubmit="return CheckSubmit()">
hope this helps you out....
Eric
 
giri shetty
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric,
can you explain me the first way to check the values are updated or not in particular jsp page .b'coz i cant use the second way using "onChange" function.
thanks
giri shetty
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will write up an example over my lunch break ~12:30EST
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note: This only works with Text Boxes and Text Areas since that is all that you require to check according to your first post

See if that helps you out any....
remember people can still get around this by disabling JavaScript
Eric
[ March 01, 2004: Message edited by: Eric Pascarello ]
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't want to put in onchange event handler code on every field there's a slightly easier way to do it, although it will get you in trouble if you're not careful
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic