Checking Radio Buttons ?

Results 1 to 2 of 2

Thread: Checking Radio Buttons ?

  1. #1
    Join Date
    Dec 1969

    Default Checking Radio Buttons ?

    Hello all<BR>I have three radio buttons and i am trying to check that at least one is checked, i have been using this but it does not work.<BR> if (theForm.whichLeg.value == "")<BR> {<BR> alert("Please enter a value for the \"whichLeg\" field.");<BR> <BR> return (false);<BR> }<BR>Can you tell me what i should be doing ?<BR><BR>George

  2. #2
    Chad LaFarge Guest

    Default RE: Checking Radio Buttons ?

    Try something like this:<BR><BR>var inputTags, isDirty=false;<BR>inputTags = document.theForm.tags("INPUT");<BR><BR>for(var i=0;i&#060;inputTags.length;i++)<BR>{ <BR> if(inputTags[i].type == "checkbox")<BR> if(inputTags[i].id.indexOf(&#039whichLeg&#039) &#062;= 0 && inputTags [i].checked)<BR> isDirty = true;<BR>}<BR> <BR>if(!isDirty)<BR> return(false);<BR>else<BR> return(true);<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts