aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How  to know the values displayed values changed or not in a jsp for update purpose Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How  to know the values displayed values changed or not in a jsp for update purpose" Watch "How  to know the values displayed values changed or not in a jsp for update purpose" New topic
Author

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

giri shetty
Greenhorn

Joined: Jan 22, 2004
Posts: 27
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Jan 22, 2004
Posts: 27
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
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I will write up an example over my lunch break ~12:30EST
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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 ]
Sahala Swenson
Greenhorn

Joined: Jul 01, 2003
Posts: 7
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to know the values displayed values changed or not in a jsp for update purpose
 
Similar Threads
How a page can be updated without refreshing the page
submit form problem
checkboxes with c tags
How to catch checkbox value
Enable/disable buttons