Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio button

Status
Not open for further replies.

discusmania

IS-IT--Management
Oct 24, 2000
158
AP
hi guys....
I've 2 radio butto with the same name (so that only i option can be clicked at 1 time ):

<input type=&quot;radio&quot; name =&quot;opt_issue&quot; value=&quot;lt&quot;>Long Term (Improvement)
<input type=&quot;radio&quot; name =&quot;opt_issue&quot; value =&quot;st&quot; checked>Short Term

how can i capture the value selected (automatically after the button is clicked) and pass the value to the next form?

thanks so much
Ron
 
do you want it to go to the next form as soon as the person clicks on the radio button? or after they hit a submit button, and just pass the value to the next form?
 
<script language=javascript>
function getValue(value){
\\do what you need to with the value here
}
</script>

<input type=&quot;radio&quot; name =&quot;opt_issue&quot; value=&quot;lt&quot; onClick=&quot;getValue(this.value);&quot;>

In that function, you can do whatever you need to, but I'm guessing that you are trying to assign the value to another form element?

document.formName.elementName.value = value;

would be the syntax for that operation --

:)
Paul Prewett
penny.gif
penny.gif
 
I want to get the value so that from the value i can set a condition:
if opt_issue=&quot;value 1&quot; then
'do task 1
else
' do task 2
end if

Thanks so much

 
Just request the name of the buttons from the next form like any other form element. example:

---page1.asp--------------------------------

<form method='post' action='page2.asp'>
<input type=&quot;radio&quot; name =&quot;opt_issue&quot; value=&quot;lt&quot;>Long Term (Improvement)
<input type=&quot;radio&quot; name =&quot;opt_issue&quot; value =&quot;st&quot; checked>Short Term
<input type='submit' value='Submit'>
</form>


---page2.asp---------------------------------

<%
Dim radioInfo
radioInfo = Request.Form(&quot;opt_issue&quot;)
response.write(&quot;&quot;&quot;&quot; & radioInfo & &quot;&quot;&quot;<BR><BR>&quot;)
If radioInfo = &quot;lt&quot; then
response.write(&quot;Long Term Selection&quot;)
Else
response.write(&quot;Short Term Selection&quot;)
End If
%>

Hope that's what you need and helps.

-Ovatvvon
 
I have these 2 radio buttons:-

<input type=&quot;radio&quot; name =&quot;ComponenetStatus&quot; value=&quot;generic&quot;>Generic
<input type=&quot;radio&quot; name =&quot;ComponenetStatus&quot; value =&quot;custom&quot; checked>Custom

and then on the next asp, after submitting with a submit button, I have the following code:-

ComponentStatus = Request.Form(&quot;ComponentStatus&quot;)

response.write(&quot;&quot;&quot;&quot; & ComponentStatus & &quot;&quot;&quot;<BR><BR>&quot;)

If ComponentStatus = &quot;Generic&quot; then
response.write(&quot;Generic&quot;)
Else
response.write(&quot;Custom&quot;)
End If

However, everytime, Custom is being written out on the page, which means that ComponentStatus is not correctly populated.

What do I have wrong?
 
JohannIcon,
from now on, don't post a new question in any current forum thread. Start your own to ask a question.

you spelled &quot;ComponenetStatus&quot; this way on the form page, and you spelled it &quot;ComponentStatus&quot; on the processing page. You just need to pay closer attention to your spelling is all. :) -Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top