NIHVIVO-725 When publication form loads, if a type selection has already been made, go to full view.
This commit is contained in:
parent
1759528741
commit
630f2ebf0c
1 changed files with 27 additions and 8 deletions
|
@ -64,12 +64,28 @@ var customForm = {
|
||||||
|
|
||||||
this.initAutocomplete();
|
this.initAutocomplete();
|
||||||
|
|
||||||
|
this.initFormView();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
initFormView: function() {
|
||||||
|
|
||||||
|
var typeVal = this.typeSelector.val();
|
||||||
|
|
||||||
if (this.formSteps == 1 || this.findValidationErrors()) {
|
if (this.formSteps == 1 || this.findValidationErrors()) {
|
||||||
this.initFormFullView();
|
this.initFormFullView();
|
||||||
} else {
|
}
|
||||||
|
// If type is already selected when the page loads (Firefox retains value
|
||||||
|
// on a refresh), go directly to full view. Otherwise user has to reselect
|
||||||
|
// twice to get to full view.
|
||||||
|
else if (typeVal.length) {
|
||||||
|
this.acType = typeVal;
|
||||||
|
this.setLabelFieldLabel();
|
||||||
|
this.initFormFullView();
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.initFormTypeView();
|
this.initFormTypeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initFormTypeView: function() {
|
initFormTypeView: function() {
|
||||||
|
@ -112,11 +128,10 @@ var customForm = {
|
||||||
|
|
||||||
// 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.acType = typeVal;
|
customForm.acType = typeVal;
|
||||||
|
|
||||||
if (typeVal.length) {
|
if (typeVal.length) {
|
||||||
customForm.labelFieldLabel.html(customForm.getSelectedTypeName() + ' ' + customForm.baseLabelText);
|
customForm.setLabelFieldLabel();
|
||||||
customForm.initFormFullView();
|
customForm.initFormFullView();
|
||||||
} 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
|
||||||
|
@ -278,6 +293,10 @@ var customForm = {
|
||||||
|
|
||||||
getSelectedTypeName: function() {
|
getSelectedTypeName: function() {
|
||||||
return this.typeSelector.find(':selected').html();
|
return this.typeSelector.find(':selected').html();
|
||||||
|
},
|
||||||
|
|
||||||
|
setLabelFieldLabel: function() {
|
||||||
|
this.labelFieldLabel.html(this.getSelectedTypeName() + ' ' + this.baseLabelText);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue