This is a fairly basic survey form; I'm using JQuery to conditionally show/hide fields based on user selections.
//FORM CONDITIONALS Hides all the helpfulness radios and only shows them when "Yes" for a particular question is checked
$("#datainp .occurrence").click(function () {
var nexttd = $(this).next('td');
if ($(this).children("input:first").is(':checked')) {
$(nexttd).show();
$(nexttd).children("input").removeAttr("checked");
} else {
$(nexttd).hide();
}
I have a client-side validation function as well:.
//Client side validation and submissions
$('#submit').click(function(e) {
e.preventDefault();
var level = $('#Level').val();
var schoolid = $('#school').val();
if (!schoolid) {
alert("Please select a school!");
return;
}
if (!level) {
alert("Please select a grade level!");
return;
}
alert("foo");
$('#frmTeacherEvalGuidance').submit(function() {alert("bar") });
});
Everything works EXCEPT the .submit() at the end of my validation (alerts verify). Is something in my form conditional section conflicting with .submit()? When I comment out the first section of javascript, the form submits as it's supposed to. JsFiddle is here: http://jsfiddle.net/r4Y4g/1/ (The html is a tad clunky, I know, but not mine; updating an old team project)