NIHVIVO-1024 When returning from validation error in educational background form (and roles form in repair mode), hide org name validation error if org name field is hidden.
This commit is contained in:
parent
e9fa47d7ed
commit
4342f28e80
1 changed files with 10 additions and 7 deletions
|
@ -22,19 +22,22 @@ vitro.customFormUtils = {
|
|||
// This method should always be called instead of calling hide() directly on any
|
||||
// element containing form fields.
|
||||
hideFields: function(el) {
|
||||
// Clear any input and error message, so if we re-show the element it won't still be there.
|
||||
// Clear any input and error messages, so if we re-show the element it won't still be there.
|
||||
this.clearFields(el);
|
||||
el.hide();
|
||||
},
|
||||
|
||||
// Clear data from form elements in element el
|
||||
clearFields: function(el) {
|
||||
el.find(':input[type!="hidden"][type!="submit"][type!="button"]').val('');
|
||||
el.find(':input[type!="hidden"][type!="submit"][type!="button"]').each(function() {
|
||||
$(this).val();
|
||||
// Remove a validation error associated with this element.
|
||||
// For now we can remove the error elements. Later we may include them in
|
||||
// the markup, for customized positioning, in which case we will empty them
|
||||
// but not remove them here. See findValidationErrors().
|
||||
$('*[id=' + $(this).attr('id') + '_validationError]').remove();
|
||||
});
|
||||
|
||||
// For now we can remove the error elements. Later we may include them in
|
||||
// the markup, for customized positioning, in which case we will empty them
|
||||
// but not remove them here. See findValidationErrors().
|
||||
el.find('.validationError').remove();
|
||||
},
|
||||
|
||||
// Return true iff there are validation errors on the form
|
||||
|
|
Loading…
Add table
Reference in a new issue