/    Sign up×
Community /Pin to ProfileBookmark

Validation problem

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>&nbsp;</td>
</tr>
<tr>
<td><label for=”lastName”>Last Name:</label></td>
<td><input name=”txtLastName” type=”text” class=”required”/></td>
<td>&nbsp;</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>&nbsp;</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>&nbsp; </p></td>
<td align=”right”><input name=”btnSubmit” type=”submit” id=”btnSubmit” value=”Send”></td>
</tr>
</table>
</form>
<% End Sub %>[/code]

The class”required” works fine around the normal inputs, just wondering if I can get them to work on the selects also?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@XileoauthorNov 21.2011 — I forgot to mention:

I'd just like the date, month, year to display one error so if one isnt entered it'll do the "this field is required" text instead of having it beside each box.

Any help would be great.
×

Success!

Help @Xileo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...