NIHVIVO-725 Reset form after an autocomplete selection, if the type gets changed.
This commit is contained in:
parent
0b742beecc
commit
6d4ebcc35e
1 changed files with 6 additions and 2 deletions
|
@ -106,14 +106,18 @@ var customForm = {
|
||||||
|
|
||||||
this.typeSelector.change(function() {
|
this.typeSelector.change(function() {
|
||||||
var typeVal = $(this).val();
|
var typeVal = $(this).val();
|
||||||
|
|
||||||
|
// If an autocomplete selection has been made, undo it
|
||||||
|
customForm.undoAutocompleteSelection();
|
||||||
|
|
||||||
// Set the type of individual that the autocomplete will search for.
|
// Set the type of individual that the autocomplete will search for.
|
||||||
// We do this even if typeVal is empty, to clear out a previous value.
|
// We do this even if typeVal is empty, to clear out a previous value.
|
||||||
//customForm.resetAutocomplete(typeVal);
|
//customForm.resetAutocomplete(typeVal);
|
||||||
customForm.acType = typeVal;
|
customForm.acType = typeVal;
|
||||||
|
|
||||||
if (typeVal.length) {
|
if (typeVal.length) {
|
||||||
customForm.labelFieldLabel.html(customForm.getSelectedTypeName() + ' ' + customForm.baseLabelText);
|
customForm.labelFieldLabel.html(customForm.getSelectedTypeName() + ' ' + customForm.baseLabelText);
|
||||||
customForm.initFormFullView();
|
customForm.initFormFullView();
|
||||||
customForm.hideFields(customForm.acSelection);
|
|
||||||
} else {
|
} else {
|
||||||
// If no selection, go back to type view. This prevents problems like trying to run autocomplete
|
// If no selection, go back to type view. This prevents problems like trying to run autocomplete
|
||||||
// or submitting form without a type selection.
|
// or submitting form without a type selection.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue