Jump to content

how to call java script external


fareedreg

Recommended Posts

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}

{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 function validateDate(fld) \{\par

    var RegExPattern = /^((((0?[1-9]|[12]\\d|3[01])[\\.\\-\\/](0?[13578]|1[02])[\\.\\-\\/]((1[6-9]|[2-9]\\d)?\\d\{2\}))|((0?[1-9]|[12]\\d|30)[\\.\\-\\/](0?[13456789]|1[012])[\\.\\-\\/]((1[6-9]|[2-9]\\d)?\\d\{2\}))|((0?[1-9]|1\\d|2[0-8])[\\.\\-\\/]0?2[\\.\\-\\/]((1[6-9]|[2-9]\\d)?\\d\{2\}))|(29[\\.\\-\\/]0?2[\\.\\-\\/]((1[6-9]|[2-9]\\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))|(((0[1-9]|[12]\\d|3[01])(0[13578]|1[02])((1[6-9]|[2-9]\\d)?\\d\{2\}))|((0[1-9]|[12]\\d|30)(0[13456789]|1[012])((1[6-9]|[2-9]\\d)?\\d\{2\}))|((0[1-9]|1\\d|2[0-8])02((1[6-9]|[2-9]\\d)?\\d\{2\}))|(2902((1[6-9]|[2-9]\\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00))))$/;\par

    var errorMessage = 'Please enter valid date as month, day, and four digit year.\\nYou may use a slash, hyphen or period to separate the values.\\nThe date must be a real date. 30/2/2000 would not be accepted.\\nFormay dd/mm/yyyy.';\par

    if ((fld.value.match(RegExPattern)) && (fld.value!='')) \{\par

        alert('Date is OK'); \par

    \} else \{\par

        alert(errorMessage);\par

        fld.focus();\par

    \} \par

\}\par

\par

}

 

 

This is my java script for validation of date dd/mm/yyyy

 

 

 

 

 

i m calling it from my html form like this

 

<td><input name="txtissue" type="text" id="txtissue" size="10" maxlength="10"/>   

 

<script language="JavaScript" type="text/javascript"> 

 

validateDate("txtissue");

 

</script>

 

</body>

 

</html>

 

 

 

showing unexpected error why

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.