View Full Version : Help with multiple onchange events and chained selects

01-12-2011, 09:23 AM
Hi guys, I nearly have it working I just have one element not working as it should. I know it is related to the multiple onchanges and the chained selects and the order of how things are applied but I have been unable to work it out and therefore I need your HELP ;)

I have created two files with the scripts working as much as I can, hopefully you can have a look at the source and go ADD THIS.

The first is a complete set of what I am trying to do.

It uses the chained selects script to dynamically generate the select options based on each other.

On making a selection it should do three things, 1st is change the image, 2nd is change a price value and 3rd change a link. No matter which way I go about it I can only get 2 of 3 working... so what am I missing?

Link: http://gmwebfiles.com/formtest/index.html

The second is the same as above but I have removed the link change requirement to show it does work for two of the onchange events, I just need it to work for all three.

Link: http://gmwebfiles.com/formtest/index2.html

I am sure there are better ways to structure what I have, and by all means suggest away, but at this stage if I can get it to work that will be enough :)

Once it is all working I will pull the scripts out of the actual document and have them all in one single file, with exception to anything that is required to be on the page (if required).



01-14-2011, 05:08 AM
The only serious problem with the first one (gmwebfiles.com/formtest/index.html) is that around line 94:

document.getElementById('cup_price').innerHTML='$'+cupprice+' each';

The highlighted is not defined. If you change that to:

document.getElementById('cup_price').innerHTML='$'+price+' each';

It 'works'.

01-14-2011, 06:23 AM
OMG! how did I miss that... two days trying to figure that out.... thanks for finding my own stupid fault.