Oops, I guess some copies of the code would help...
HTML:
HTML Code:
<!-- Contact Form -->
<form id="edf" method="post" autocomplete="off" action="http://us.1.p10.webhosting.yahoo.com/forms?login=xxxxxxx" >
<fieldset>
<legend> Contact Form </legend>
<p> We never sell or share your information. </p>
<label>Message</label>
<textarea class="input-block-level" rows="3" name="reporting" id="reporting" maxlength="1000">
</textarea>
<span class="help-block">
If you would like us to reply to your message, please enter at least two of the following questions.
</span>
<label>Name</label>
<input class="input-block-level" type="text"
name="person" id="person">
<label>Email</label>
<input class="input-block-level" type="text"
name="onlineaddress" id="onlineaddress">
<label>Phone Number</label>
<input class="input-block-level" type="text"
name="ringer" id="ringer">
<div class="control-group" style=text-align:center; >
<label class="control-label" for="checker"><strong>To prevent automated spam, you must answer this question:</strong>
<br />What is 6 + 6 ?</label>
<div class="controls">
<input class="input-mini" type="text" name="quiz" id="quiz" >
</div>
</div>
<br />
<div class="form-actions" style=text-align:center;>
<button class="btn btn-large btn-primary" type="submit"> Send Message </button>
</div>
</fieldset>
</form>
JAVASCRIPT:
Code:
<!-- Scripts for ContactForm -->
<script src="../assets/js/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$('#edf').validate(
{
rules: {
quiz: { equalTo: '12', required: true }
},
highlight: function(label) {
$(label).closest('.control-group').addClass('error');
},
success: function(label) {
label
.text('OK!').addClass('valid')
.closest('.control-group').addClass('success');
}
});
}); // end document.ready
</script>
</head>
Special CSS: (much is specific to Twitter Bootstrap)
Code:
<style type="text/css">
label.valid {
width: 24px;
height: 24px;
background: url(../assets/img/Done.png) center center no-repeat;
display: inline-block;
text-indent: -9999px;
}
label.error {
font-weight: bold;
color: red;
padding: 2px 8px;
margin-top: 2px;
}
</style>
Bookmarks