Click to See Complete Forum and Search --> : How can I make selected a radio button based a value passed by an other form
mpoincare
January 12th, 2003, 07:44 PM
I have 3 radio buttons on a web page. I would like to have a vbscript sample of how can I make selected either one of them based on a value passed by an other form.
I also have the same request for a dropdown list box. I would like to make selected the option from the list based on a value passed by an other form.
antares686
February 5th, 2003, 06:12 AM
Actually these are generally done in the ASP code using Request and the parameter submitted. Then you just check for the value condition and insert the word checked or selected into the appropriate item.
ASP CODE
<%
DD1Sel = Request("DD1Sel")
%>
<Select name="Test" size="1">
<option vaue="1"<%if DD1Sel = 1 then Response.Write(" selected")%>>1
<option vaue="2"<%if DD1Sel = 2 then Response.Write(" selected")%>>2
<option vaue="3"<%if DD1Sel = 3 then Response.Write(" selected")%>>3
</select>
This is the most common way. I am sure thou you could push the value to the vbscript on load similarly but then you have to place at the bottom of your page so it executes when all else is done and you can run into issues. It is far cleaner to do as suggested in the above.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.