Hi there,
I’m using jquery and the simple validation plugin. I have this form and it has 2 select fields that are using loops to generate the date and month. Is there anyway to use this plugin to validate those fields too? I didn’t code the form I just added the plugin to make it look nicer.
The source:
[code=php] <div class=”content”>
<h1>Forgot Password</h1>
<%Sub formtofill %>
<p>Please enter your details in the form below and your password will be sent to you:</p>
<form id=”frmForgot” name=”frmForgot” method=”post” action=”forgot_new.asp” onSubmit=”return checkPw(this)”>
<table width=”90%” border=”0″>
<tr>
<td><label for=”firstName”>First Name:</label></td>
<td><input name=”txtFirstName” type=”text” class=”required” /></td>
<td> </td>
</tr>
<tr>
<td><label for=”lastName”>Last Name:</label></td>
<td><input name=”txtLastName” type=”text” class=”required”/></td>
<td> </td>
</tr>
<tr>
<td><label for=”dob”>Date of Birth:</label></td>
<td><select name=”sltDay”>
<option value=””>day</option>
<% For i = 1 to 31
Response.Write(“<option “)
If intDay = i Then
Response.Write(” selected “)
end if
Response.write (“value=”)
If (i > 0 and i < 10) Then
Response.write(i & “>” & “0” & i & “</option>” )
Else
Response.Write( i & “>” & i & “</option>” )
End If
Next %>
</select>
<select name=”sltMonth”>
<option value=””>month</option>
<% For i = 1 to 12
Response.Write(“<option “)
If intMonth = i Then
Response.Write(” selected “)
end if
Response.write (“value=”)
If (i > 0 and i < 10) Then
Response.write(i & “>” & “0” & i & “</option>” )
Else
Response.Write( i & “>” & i & “</option>” )
End If
Next %>
</select>
<input name=”Year” type=”text” class=”required” id=”Year” class”required” onblur=”MM_validateForm(‘Year’,”,’NinRange1940:1989′);return document.MM_returnValue” value=”” size=”6″ maxlength=”4″> </td>
<td> </td>
</tr>
<tr>
<td><label for=”email address”>Email Address:</label></td>
<td><p>
<input name=”Email” type=”text” class=”required” id=”Email” onblur=”MM_validateForm(‘Email’,”,’NisEmail’);return document.MM_returnValue” size=”40″/>
</p>
<p> </p></td>
<td align=”right”><input name=”btnSubmit” type=”submit” id=”btnSubmit” value=”Send”></td>
</tr>
</table>
</form>
<% End Sub %>
The class”required” works fine around the normal inputs, just wondering if I can get them to work on the selects also?