html - Javascript form validation radio and check boxes -


ok have new problem js form validation project.

i can't radio , checkboxes validate , throw error messages.

i have external .js script function rules linked in html within head section.

the function rules this:

    /* ====================================================================== function:   isvalid4digitzip  input:      str (string) - 5-digit zip code tested  return:     true, if string 5-digits long         false, otherwise  calls:  isblank(), isint() defined elsewhere in script library  platforms:  netscape navigator 3.01 , higher,             microsoft internet explorer 3.02 , higher,             netscape enterprise server 3.0,             microsoft iis/asp 3.0. ====================================================================== */ function isvalid4digitzip( str ) {     // return if invalid value passed in     if (str+"" == "undefined" || str+"" == "null" || str+"" == "")           return false;      var isvalid = true;      str += "";      // rules: zipstr must 5 characters long, , can contain numbers    // 0 through 9    if (isblank(str) || (str.length != 4) || !isint(str, false))         isvalid = false;     return isvalid; } // end isvalid4digitzip 

how add function rules external .js script validate radio , checkbox forms in html. can guide me on how write function rules?

and how call these rules radio , checkboxes in section?

validation checkbox , radio button checked function

in javascript

<script> if (document.getelementbyid("male").checked || document.  getelementbyid("female").checked) {   //messages } </script> 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -