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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio buttons always checked

Status
Not open for further replies.

3allawy

Programmer
Oct 19, 2005
28
CA
Hi,

The problem I am facing is that when you select one of my two radio buttons and submitt the form, that button stays checked, even if you select the other button. I have removed the checked attribute but still the same..Any Ideas :D


<form id="quicksearch" name="quicksearch" action="scripts/search.cfm" method="post">

<label for="quicksearchBox">Search:</label> <input class="styledinput" tabindex="1" accesskey="S" type="text" name="Search" id="quicksearchBox" size="9" /><input class="styledinput" tabindex="2" type="submit" value="Go" id="quicksearchButton" /><br /><br />

<p><input type="radio" accesskey="J" name="Jmsb" value="J"/> JMSB </p>

<p><input type="radio" accesskey="C" name="Conc" value="C" /> DIS </p>

</form>
 
Hi,

Is there anyother way because I think they should have different names to be able to deal with them in action script
 
If you want them to work as a group of radio buttons, they have to have the same name. How else can the browser know which buttons should send which value?

I don't know about ActionScript (why would a Flash applet want to interact with your search box?), can you access via the ID instead?
Code:
<p><input type="radio" accesskey="J" name="type" id="Jmsb" value="J"/> JMSB </p>

<p><input type="radio" accesskey="C" name="type" id="Conc" value="C" /> DIS </p>

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
after submitting the form, does the server side script generate the page?

scripts/search.cfm

could be that the script is retaining the "checked" status of the radio button and putting that back into the form if it's dynamically generated. There is no reason a radio button would remain checked if the page were purely static html, so look into the script you are using and see if the "problem" resides there.
 
Got it..............using <cfparam name="form.JC" type="string" default="" />

----------------------------form.cfm---------------------

<form id="quicksearch" name="quicksearch" action="respnoseradio.cfm" method="post">

<label for="quicksearchBox">Search:</label> <input class="styledinput" tabindex="1" accesskey="S" type="text" name="Q" id="quicksearchBox" size="9" /><input class="styledinput" tabindex="2" type="submit" value="Go" id="quicksearchButton" /><br /><br />

p><input type="radio" accesskey="J" name="JC" value="J"/> John Molson School of Business</p>

<p><input type="radio" accesskey="C" name="JC" value="C" /> Concordia University</p> </form>




-----------------------------response.cfm-------------------------


<CFSET myVAR1 = "<CFSET myVAR2 = "
<cfparam name="form.JC" type="string" default="" />

<cfif form.JC IS "J">
<cflocation url= "#myVAR2#" addtoken="no">
</cfif>

<cfif form.JC IS "C">
<cflocation url= "#myVAR1#" addtoken="no">
</cfif>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top