Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript validation procedures

Status
Not open for further replies.

databarn

Programmer
Sep 19, 1998
202
US
Folk,<br>
<br>
I really need some help on this, 'cause I'm novitiate in this area.<br>
<br>
I need to be able to do some forms input validation <b>before</b> allowing web-page input to be stored in a database (SQL Server 7.0, but that shouldn't be significant, I'd think).<br>
<br>
I can do the validation by referencing every input field in the form, but I have to do that for each individual form.<br>
<br>
What I would <i>like</i> to do would be to set up a routine similar to what I can do with the Visual Basic 'TypeOf' conditional.<br>
<br>
For instance, in VB I can do<br>
<br>
{code simulacrum]<br>
Sub Validate (somecontrol as Control)<br>
If TypeOf somecontrol is textbox then<br>
. . .<br>
Else If TypeOf somecontrol is maskeditbox then<br>
. . .<br>
End If<br>
End Sub<br>
<br>
[/code simulacrum]<br>
<br>
and validate control content based upon the control type, e.g., determine text in a text area or input box, determine value of an option button array, etc..<br>
<br>
Is there a way to do this with JavaScript?<br>
<br>
When I'm looking at fifty or sixty forms, this would show great economies of sanity!<br>
<br>
Make a good day . . .<br>
. . . barn<br>
<br>

 
There is a typeof operator is javascript. This should not be confused with its visual basic synonnym (sp? :) <br><br>typeof in javascript returns one of several broad strings:<br><br>&quot;string&quot; &quot;undefined&quot; &quot;object&quot; &quot;number&quot; & &quot;boolean&quot;<br><br><A HREF="mailto:jared@aauser.com">jared@aauser.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top