I think it would be great to call the jquery hide function on the .help-inline element when the model is valid and call the jquery show function on this element when thes model isn't valid.
I think it's better to not reserve the space of the .help-inline element when there is no error.
What do you think about that ?
eg :
valid: function(view, attr, selector) {
// find matching form input and remove error class and text if any
var attrSelector = '[' + selector + "~=" + attr + ']';
// get the control group element
view.$(attrSelector).closest('.control-group').removeClass('error');
// get the controls element
view.$(attrSelector).closest('.control-group').find('.help-inline').text('');
view.$(attrSelector).closest('.control-group').find('.help-inline').hide();
},
invalid: function(view, attr, error, selector) {
// find matching form input and add error class and text error
var attrSelector = '[' + selector + '~=' + attr + ']';
// get the control group element
view.$(attrSelector).closest('.control-group').addClass('error');
// get the controls element
view.$(attrSelector).closest('.control-group').find('.help-inline').text(error);
view.$(attrSelector).closest('.control-group').find('.help-inline').show();
}
why not ...display none or hide/show is only matter of choice and could be overrided if needed by projects. We could switch by default to show/hide version ...
I think it would be great to call the jquery hide function on the .help-inline element when the model is valid and call the jquery show function on this element when thes model isn't valid.
I think it's better to not reserve the space of the .help-inline element when there is no error.
What do you think about that ?
eg :