radio button checking

Results 1 to 3 of 3

Thread: radio button checking

  1. #1
    Join Date
    Dec 1969

    Default radio button checking

    I know this is more of a js question but i need to be able to check if a radio button has been selected or not and if not generate a alert box. I can do it for text fields with <BR><BR>if (document.myform.q4.value.length==0)<BR> {<BR> alert(&#039;You have not entered your Industry sector.&#039;);<BR> return false;<BR> }<BR><BR>but not sure how to do it with a radio button? any ideas???

  2. #2
    Join Date
    Dec 1969

    Default If you know it's a JS question..

    .. why not post in the JScript forum?<BR><BR>Oh, well.<BR><BR>You have to check each of the radio buttons to see if they are checked. JavaScript puts them into an array that you can loop through:<BR>var bChecked = false;<BR>for(var x=0; x&#060;document.formname.radioName.length; x++)<BR>{<BR> if(document.formname.radioName[x].checked == true)<BR> {<BR> bChecked = true;<BR> break;<BR> }<BR>}<BR><BR>if(!bChecked)<BR>{<BR> alert(&#039;You should post in the correct forum, moron.&#039;);<BR>}<BR><BR>-Doug

  3. #3
    Join Date
    Dec 1969

    Default Monday morning humor... Thanks Doug..

    Too funny.

Posting Permissions

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