• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

capturing change event in the drop down

 
Venkat Babu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check to see what actual values are getting compared? Are they what you expect?
 
Venkat Babu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alert() ?

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear and Eric. I was able to debug the problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic