Looping Over Variable Radio Button Pairs
Posted on 2011-03-01
I am a newbie in JS so please be patient. I also think this may be a tough question?
I have a page with a variable set of radio button pairs (ship email = 1, ship usps = 2). The number of pairs is in a hidden text field (name=numRadio). Each set of radio buttons has a unque ID=Radio_1, Radio_2 etc.
When a radio button is changed by a user, I need to create a script that will look at all the radio button pairs:
Condition: If they are all selected and have the same value = 1
change the value and class of a set of address input text fields.
Condition: If they are all selected and have the same value = 2
change the value and class off a different set of address input text fields.
Otherwise, Do nothing.
The basic objective is that if all the products are chosen to be sent by email, then disable the physical addess side of the page. If the are all selected to be sent by mail, then disable the email side of the page. If the are mixed then display both sides of the page.
I think I know how to manipulate the input fields (more or less) but I don't know how to test for the conditions above.
I think this may be complicated but many very smart folks are in this forum!!!
Thanks in advance for your expertise,