wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes capturing change event in the drop down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "capturing change event in the drop down" Watch "capturing change event in the drop down" New topic
Author

capturing change event in the drop down

Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
I need some help on this. Thanks in advance.

I have 4 pages, all 4 pages have drop down, text, radio....

In page1 drop down, if the value is changed and go the next step without
saving, I need to give a popup message saying,
"You have made changes to this page. Clicking OK will disregard your changes. Do you wish to continue without saving?"

But I am getting the popup even if there is no change.

Here's the code:

case "select-multiple" :

for (var x = 0, y = ele[i].options.length; x < y; x++) {

if ( ele[i].options[ x ].selected != ele[i].options[ x ].defaultSelected ) return true;

}

break;
[ June 07, 2007: Message edited by: Venkat Babu ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Did you check to see what actual values are getting compared? Are they what you expect?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
Bear,

I am not good at JavaScript, if I need to print those two values, do I need to use document.write()?. I tried giving that it doesn't print. Can I print to the standard output? Thanks a lot.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
alert() ?

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

If you're going to be writing JavaScript, you need to learn a bit about how to debug your code.

I highly recommend Firebug for Firefox. With it, you can write to the Firebug "console" using:



Very useful during debugging!

Failing that, using good old alerts is better than nothing.

And no, you can't use document.write once the page has finished loading.
Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
Thanks Bear and Eric. I was able to debug the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: capturing change event in the drop down