Choose Radio Before Submit

[Total: 0    Average: 0/5]

Must choose radio button before submitting.

Body Code:

<SCRIPT language=JavaScript> 
function Go(_f){ 
  var _ret=false; /* this will cancel the submit */
if(_f.radioname[0].checked)
{
  _f.action="http://www.yoursite.com/style2_tool_frame.html";
  _ret=true;
} 
if(_f.radioname[1].checked)
{
  _f.action="http://www.yoursite.com/style3_tool_frame.html";
  _ret=true;
} 
if(!_ret)
  alert("You must choose one first!");
return(_ret);
}
</SCRIPT> 

</head> 

<FORM name=formname onsubmit="return Go(this)"> 
<INPUT type=radio name=radioname value=style2 >
<INPUT type=radio name=radioname value=style3 >
<INPUT type="image" src="/js/pic1.gif" name="Go" value="Go"> 
</form> 

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *