Quantcast
Channel: Adobe Community : All Content - ColdFusion
Viewing all articles
Browse latest Browse all 5979

validate check box

$
0
0

I have the type file for users to upload file.  If they browse the file, they have  to select the document type from the check box and versus.  This code didn't do what  I want.  Can onyone pls help?

Thanks

 

 

<script>

function validateForm(oForm) {

 

 

var numChecked = 0;

        for (var idx=0; idx<oForm.doc_type.length; idx++) {

                if (oForm.doc_type[idx].checked == true) {

                        numChecked++;

                        break;

                }

        }

 

if (document.getElementById ("cpc").value.length ! == 0)

           if (numChecked == 0){

                alert('Please check at least one checkbox');

                return false;

        }

 

                     return false;

 

 

 

}

          //all checked, then return true for submit

          return true;

 

 

} </script>

 

 

<form action="index.cfm?action=APrpocess" method="post"  enctype="multipart/form-data" name="form" id="form" onsubmit="return validateForm(this);">

<input name="cpc" class="upload" type="file" id="cpc" size="20" tabindex="8" />

          <cfloop query="variables.qDocType">

        <input  type="radio" id="doc_type" name="doc_type" size="20" tabindex="3"  value="#id_int#" <cfif id_int eq form.doc_type>checked="checked" </cfif> />#type_var#

     </cfloop>

</form>


Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>