Need Help Validating Textbox for Specific Length and content

nick1337

New Member
I have the following validation code on my .asp webpage. I also need to validate the \[code\]txtndc\[/code\] \[code\]textbox\[/code\] so that the data entered looks like this. 00000-0000 Currently they can enter any info in this textbox. The entry should always be 5 numbers a dash and 4 numbers. Any help would be greatly appreciated.\[code\]function form_onsubmit() { if (form1.txtdrug.value =http://stackoverflow.com/questions/12039523/="") { alert("Drug Name Needed"); return false; } if (form1.txtndc.value =http://stackoverflow.com/questions/12039523/="") { alert("NDC Number Needed"); return false; } if (form1.txtndc.value != "" && form1.txtdrug.value != "") { alert("Drug was Successfully entered into the database, hit enter to continue."); return true; }}\[/code\]
 
Back
Top