Reputation: 4638
This could well be a duplicate of an existing question. Can anyone recommend a Javascript or Jquery form validation script which offers the following.
Normally I'd just use the validation controls which come with asp.net, but in this case I'm not using .net
Cheers
Edit - html here. And yes, we're trying to add a new skin to an old site!
<form method="post">
<table>
<tr>
<td class="td-right" valign="top">Name:</td>
<td><input style="width:400px" type="text" name="name" /></td>
</tr>
<tr>
<td class="td-right" valign="top">Telefon:</td>
<td><input style="width:400px" type="text" name="telephone" /></td>
</tr>
<tr>
<td class="td-right" valign="top">Email-Adresse:</td>
<td><input style="width:400px" type="text" name="from" /></td>
</tr>
<tr>
<td class="td-right" valign="top">Thema:</td>
<td><input style="width:400px" type="text" name="subject" /></td>
</tr>
<tr>
<td class="td-right" valign="top">Nachricht:</td>
<td><textarea style="width:400px; height:200px" name="message"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input class="button" type="submit" name="submit" value="senden" /></td>
</tr>
</table>
</form>
Upvotes: 0
Views: 1430
Reputation: 5309
Look the example....
$("#f_valid").validate(
{
rules:
{
firstname:"required",
address:"required",
pin:
{
required:true,
digits:true,
minlength:6,
},
gender:"required",
dob:
{
required:true,
dateISO:true,
},
statename:"required",
mobile:
{
required:true,
digits:true,
rangelength: [10, 12]
},
email:
{
required:true,
email:true,
},
password:
{
required:true,
minlength:6,
},
confirmpassword:
{
required:true,
equalTo:'#pass'
},
keyskills:"required",
course_done:"required",
university:"required",
yearof passing:
{
required:true,
digits:true,
},
mark1:
{
required:true,
digits:true,
},
photo:
{
required:true,
extension:'jpg|png|gif',
},
resume:
{
required:true,
extension:'txt|doc|docx|pdf',
},
},
errorPlacement:function(error, element)
{
if($(element).attr("name")=="gender")
{
$(element).parent().append(error);
}else
{
$(error).insertAfter(element);
}
},
});
Upvotes: 1