| 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: 56150
|
|
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 ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
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: 15357
|
|
|
I will write up an example over my lunch break ~12:30EST
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
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: jrebel
|
|
subject: How to know the values displayed values changed or not in a jsp for update purpose
|
|
|