Forums
This topic is locked
radiogroup and if/else structure
Posted 20 Jan 2003 12:03:13
1
has voted
20 Jan 2003 12:03:13 Dik Hendriks posted:
I want to fill a certain database-field (slim_1_image) with information depending on the choice in a Radiogroup.I created a hidden-field (hf_1), the value of this hiddenfield has to depend on the choice made (value_1, value_2, value_3). This must be done with an if / else structure (i think). Is this possible?, and is there someone who can help me with the code? I am working in ASP J-script.
The basic code is:
<td><label>
<input type="radio" name="RadioGroup" value="car">
car</label></td>
<td><input type="radio" name="RadioGroup" value="motor">
motor</td>
<td><input type="radio" name="RadioGroup" value="else">
else <input name="hf_1" type="hidden" id="hf_1" value="<%=(rsSlim.Fields.Item("slim_1_image".Value)%>"></td>
</tr>
thanks!
Replies
Replied 23 Jan 2003 07:11:31
23 Jan 2003 07:11:31 Tony Chronopoulos replied:
<pre id=code><font face=courier size=2 id=code>
<head>
<title>Radio Group Example</title>
<script language=javascript>
<!--
function changeRadioGroup(value) {
document.example.hf_1.value = value;
document.example.submit();
}
//-->
</script>
</head>
<body>
<form name="example" action="">
<input type="radio" name="RadioGroup" value="car" onClick="changeRadioGroup('car')"> car <br>
<input type="radio" name="RadioGroup" value="motor" onClick="changeRadioGroup('motor')"> motor <br>
<input name="hf_1" type="hidden" id="hf_1" value="<%=(rsSlim.Fields.Item("slim_1_image".Value)%>">
</form>
</font id=code></pre id=code>
-------
I don't know if this is what you were looking for but if the user doesn't select one of the radio buttons, then you're default value will be submitted.
___________________
microdesign² | www.microdesign2.com
<head>
<title>Radio Group Example</title>
<script language=javascript>
<!--
function changeRadioGroup(value) {
document.example.hf_1.value = value;
document.example.submit();
}
//-->
</script>
</head>
<body>
<form name="example" action="">
<input type="radio" name="RadioGroup" value="car" onClick="changeRadioGroup('car')"> car <br>
<input type="radio" name="RadioGroup" value="motor" onClick="changeRadioGroup('motor')"> motor <br>
<input name="hf_1" type="hidden" id="hf_1" value="<%=(rsSlim.Fields.Item("slim_1_image".Value)%>">
</form>
</font id=code></pre id=code>
-------
I don't know if this is what you were looking for but if the user doesn't select one of the radio buttons, then you're default value will be submitted.
___________________
microdesign² | www.microdesign2.com
Replied 23 Jan 2003 10:20:42
23 Jan 2003 10:20:42 Dik Hendriks replied:
Thanks Bloodtrain for your reaction. But this is not what i had in mind.
When a visitor of the site makes a choice (clicks a readiobutton) a value is submitted to the coresponding databasefield. Want i want is that a second value is submitted to another databasefield. So, one choice, two values to different fields.
When a visitor of the site makes a choice (clicks a readiobutton) a value is submitted to the coresponding databasefield. Want i want is that a second value is submitted to another databasefield. So, one choice, two values to different fields.