• 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

capturing change event in the drop down

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67746
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
alert() ?

Eric
 
Bear Bibeault
Sheriff
Posts: 67746
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear and Eric. I was able to debug the problem.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic