Form with invalid field followed by valid file field does not mark any fields as erroneous on submit #3

cheshire137 opened this Issue Apr 6, 2012 · 0 comments

2 participants


I had a form with two fields, both validated. The first field required a value, and defaulted to having no value. The second field was type=file and did not require a value. Without touching either of the fields, I hit the submit button for the form. The first field was not marked as erroneous (unexpected behavior), nor was the second field (expected behavior). I think I fixed the problem. I changed this:

if (validate_field('#' + SelfID)) {

    jQuery('.' + options['error_message_class']).remove();
    jQuery('.' + options['error_container_class']).removeClass('error');

    return true;
    return false;

To this:

var fieldSel = '#' + SelfID;
if (validate_field(fieldSel)) {
    jQuery(fieldSel + ' + .' + options['error_message_class']).remove();
    jQuery(fieldSel).closest('.' + options['error_container_class'])
    return true;
} else {
    return false;

You were removing all error messages and taking the 'error' class off of all control-group div's, instead of just those associated with the field that's valid.

@ddarren ddarren closed this Apr 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment