NIHVIVO-1110 Fix cancel button after validation errors on all custom form types
This commit is contained in:
parent
6f2dcba70d
commit
2a2d87006b
1 changed files with 19 additions and 29 deletions
|
@ -159,15 +159,6 @@ var customForm = {
|
|||
this.showAutocompleteSelection(label, uri);
|
||||
}
|
||||
|
||||
this.cancel.unbind('click');
|
||||
this.cancel.click(function() {
|
||||
// Cancel back to full view with only type selection showing
|
||||
customForm.undoAutocompleteSelection();
|
||||
customForm.clearFields(customForm.fullViewOnly);
|
||||
customForm.initFormFullView();
|
||||
return false;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
// Bind event listeners that persist over the life of the page. Event listeners
|
||||
|
@ -178,13 +169,7 @@ var customForm = {
|
|||
var typeVal = $(this).val();
|
||||
|
||||
// If an autocomplete selection has been made, undo it.
|
||||
// The test is not just for efficiency: undoAutocompleteSelection empties the acSelector value,
|
||||
// which we don't want to do if user has manually entered a value, since he may intend to
|
||||
// change the type but keep the value. If no new value has been selected, form initialization
|
||||
// below will correctly empty the value anyway.
|
||||
if (!customForm.acSelection.is(':hidden')) {
|
||||
customForm.undoAutocompleteSelection();
|
||||
}
|
||||
|
||||
// Reinitialize view. If no type selection in a two-step form, go back to type view;
|
||||
// otherwise, reinitialize full view.
|
||||
|
@ -357,6 +342,11 @@ var customForm = {
|
|||
// selection (from showAutocomplete) before returning to full view.
|
||||
undoAutocompleteSelection: function() {
|
||||
|
||||
// The test is not just for efficiency: undoAutocompleteSelection empties the acSelector value,
|
||||
// which we don't want to do if user has manually entered a value, since he may intend to
|
||||
// change the type but keep the value. If no new value has been selected, form initialization
|
||||
// below will correctly empty the value anyway.
|
||||
if (!this.acSelection.is(':hidden')) {
|
||||
this.acSelectorWrapper.show();
|
||||
this.hideFields(this.acSelection);
|
||||
this.acSelector.val('');
|
||||
|
@ -367,7 +357,7 @@ var customForm = {
|
|||
if (this.formSteps > 1) {
|
||||
this.acSelection.find('label').html('Selected ');
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// Set type uri for autocomplete, and type name for labels and button text.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue