I asked this at the tail end of an answered message, but thought I'd try to see if anyone can help in a new post. The original post is here
http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=7&threadid=723495
-----
How can I have another button pressed, that changes the values based on what's in there.
For example, button 1 values can be changes depending on which radio button the initially clicked, and a 2nd button.
After pressing the 1st button 1st option
Input 1 = 10, 20, 30, 40
If I pressed 1st buttons 2nd option
Input 1 = 100, 200, 300, 400
If I pressed 1st buttons 3rd option
Input 1 = 1000, 2000, 3000, 4000
Then on the 2nd button, I want to choose option A or B
Once this is clicked, I need to see what values are in the Input 1 box, and replace them with A or B values depending on what's initially there, meaning
If Input 1 = 10, 20, 30, 40 then set Input 1 = 10.5, 20.5, 30.5, 40.5
If Input 1 = 100, 200, 300, 400 then set Input 1 = 100.75, 200.75, 300.75, 400.75
etc..
I'm just curious how a 2nd button can look for a 1st buttons input and change it accordingly. Any ideas?
<P><input type="button" value="Click Me" onclick="chkme()">
</form>
<div id="display"></div>
</BODY>
</HTML>
rwaring
11-21-2003, 01:54 PM
This was close to what I'm getting at.
I have 18 radio buttons.
Each one has four dollar amount values.
Based on which of the 18 you pick, four input boxes are populated with the four values for the selected radio button.
Immediately below it, I have three radio options. Each option is a different set (3 total sets) of each of the values contained in the initial 18 values.
Bascially, each of the 18 buttons has three sets of the same dollar amounts. The three radio buttons below it represent years, button one of the three at the bottom of the form shows me select button of the 18's 2001 dollar amounts, button two of the three at the bottom of the form shows me the selected button of the 18's 2002 dollar amounts, and button three of the three at the bottom of the form shows me the selected button of the 18's 2003 dollar amounts.
Also, a user CAN not select one of the three unless he's picked on of the 18 options above it first.
This is kicking my butt, any help is appreciated.
Hope that makes better sense.
Close, but the A,B,C options should relflect the years as options and depending on if you choose A(2001), B(2002), C(2003) it changed all four values depening which button you pressed, and which button at the top was selected.
this is very close now, but basically each one of the buttons, 1 thru 18 has three versions of the same four values (Per Year, the A,B,C) buttons that I need to spit out.
I appreciate your assistance in this matter. I'm learning a lot!
Mr J
11-21-2003, 04:28 PM
The A, B, and C options do change all the 4 textbox values its just that I have put the same information in the array indexes except for the first index.
this is very close now, but basically each one of the buttons, 1 thru 18 has three versions of the same four values (Per Year, the A,B,C) buttons that I need to spit out.
Post me a list of the three versions that will be shown for each of the radio buttons
rwaring
11-21-2003, 09:47 PM
A would be 1.97, 2.97, 2.99, 5.00
B would be 2.99, 3.99, 6.99, 10.99
C would be 5.99, 7.99, 8.99, 15.00
Mr J
11-22-2003, 04:29 AM
Ok, lets see how we do with this.
Each of the 18 radio buttons has three sets of four values.
Depending on which radio button is selected from A, B, or C determines which of the three sets is shown in the four textboxes.
The three values you posted have been assigned to radio button one
This looks like it'll work, but I need it to default to year 3 and check the C option by default when 1-18 are chosen for the first time. This way the end user visually sees the default values are for year 3.
I took out
this_radio= -1
so I don't get the alert, and changed the
which_year = -1
to which_year =3 and set the C option to be checked by default!!!
YES!!! this is so great, thank you so very much. I've done radio buttons to change values, but not based on another buttons value. Just think of all the hair you've saved (From me pulling it out of my head)
:p
rwaring
11-22-2003, 01:26 PM
This works great except if they choose A, B or C before click the button above, I get an error. Is there any way around this?
Mr J
11-22-2003, 02:38 PM
You were getting the alert because I forgot to delete it, sorry
The variables this_radio= -1 and which_year = -1
must be in the script as they are preventative measures.
This is the reason you are getting the errors now when radio button A, B, or C is selected first.
I have amended the script, let me know how it goes