[jQuery] [validate] My form isn't playing nicely. Any help would be great!
Hey all,
As the title of this thread suggests I am having some troubles with
the validation jQuery plugin.
Here's the code I am using:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/
plugins/validate/lib/jquery.delegate.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/
plugins/validate/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#form_email_38366").validate({
rules: {
q38373_q3: "required"
},
q38373_q6: {
required: "#q38373_q5_0:checked, #q38373_q5_1:checked"
},
});
$("#q38373_q2_0, #q38373_q2_1, #q38373_q2_2").click(function() {
alert("hello" + $("#q38373_q3").valid());
});
$("#q38373_q5_0, #q38373_q5_1").click(function() {
alert("hello");
$("#q38373_q6").valid();
});
});
</script>
<style>
label { font-family: Arial, Helvetica, sans-serif; font-size: small; }
br { clear: both; }
input { border: 1px solid black; }
label.error {
display:none;
background: red;
padding-left: 16px;
margin-left: .3em;
}
label.valid {
background: green;
display: block;
width: 16px;
height: 16px;
}
</style>
<form id="form_email_38366" enctype="multipart/form-data" action="/
intranet/it_policies__and__procedures/it_systems_use_survey/_nocache"
method="post" >
<ul><li><input type="radio" name="q38373:q2" id="q38373_q2_0"
value="0" class="sq-form-field" /> <label for="q38373_q2_0">1 -
Poor</label></li><li><input type="radio" name="q38373:q2"
id="q38373_q2_1" value="1" class="sq-form-field" /> <label
for="q38373_q2_1">2 - Below Average</label></li><li><input
type="radio" name="q38373:q2" id="q38373_q2_2" value="2"
checked="checked" class="sq-form-field" /> <label
for="q38373_q2_2">3 - Average</label></li><li><input type="radio"
name="q38373:q2" id="q38373_q2_3" value="3" class="sq-form-field" /