NIHVIVO-3825 fields now retain values after validation error
This commit is contained in:
parent
f739b86766
commit
4d187cfe67
2 changed files with 14 additions and 7 deletions
|
@ -7,7 +7,7 @@ var mailingAddressUtils = {
|
||||||
this.bindEventListeners();
|
this.bindEventListeners();
|
||||||
this.sortCountrySelector(mode,country);
|
this.sortCountrySelector(mode,country);
|
||||||
|
|
||||||
if ( mode == "add" ) {
|
if ( mode == "add" && !this.errorSection.attr('id') ) {
|
||||||
this.containerDiv.hide();
|
this.containerDiv.hide();
|
||||||
this.submitButton.hide();
|
this.submitButton.hide();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ var mailingAddressUtils = {
|
||||||
this.submitButton = $('#submit');
|
this.submitButton = $('#submit');
|
||||||
this.containerDiv = $('#addressDetails');
|
this.containerDiv = $('#addressDetails');
|
||||||
this.orSpan = $('span.or');
|
this.orSpan = $('span.or');
|
||||||
|
this.errorSection = $('section#error-alert');
|
||||||
},
|
},
|
||||||
|
|
||||||
bindEventListeners: function() {
|
bindEventListeners: function() {
|
||||||
|
@ -118,7 +118,14 @@ var mailingAddressUtils = {
|
||||||
// if it's add mode, add the "select one" option have it be selected;
|
// if it's add mode, add the "select one" option have it be selected;
|
||||||
// if it's edit mode, add the "Select one" option but have the correct country selected.
|
// if it's edit mode, add the "Select one" option but have the correct country selected.
|
||||||
// if it's repair mode, add the "Select one" option but only select it if there's no country
|
// if it's repair mode, add the "Select one" option but only select it if there's no country
|
||||||
if ( mode == "add" ) {
|
|
||||||
|
if ( this.errorSection.is(':visible') ) {
|
||||||
|
this.countrySelector.prepend($("<option></option>")
|
||||||
|
.attr("value","")
|
||||||
|
.text("Select one"));
|
||||||
|
this.countrySelector.val(country);
|
||||||
|
}
|
||||||
|
else if ( mode == "add" ) {
|
||||||
this.countrySelector.prepend($("<option selected></option>")
|
this.countrySelector.prepend($("<option selected></option>")
|
||||||
.attr("value","")
|
.attr("value","")
|
||||||
.text("Select one"));
|
.text("Select one"));
|
||||||
|
@ -136,5 +143,4 @@ var mailingAddressUtils = {
|
||||||
this.countrySelector.val(country);
|
this.countrySelector.val(country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -79,9 +79,10 @@
|
||||||
<label for="country" style="margin-bottom:-4px">Country ${requiredHint}</label>
|
<label for="country" style="margin-bottom:-4px">Country ${requiredHint}</label>
|
||||||
<#assign countryOpts = editConfiguration.pageData.country />
|
<#assign countryOpts = editConfiguration.pageData.country />
|
||||||
<select id="country" name="country" >
|
<select id="country" name="country" >
|
||||||
<#list countryOpts?keys as key>
|
<#list countryOpts?keys as key>
|
||||||
<option value="${countryOpts[key]?uncap_first?replace("the ", "")?cap_first}" >
|
<#assign countryName = countryOpts[key]?uncap_first?replace("the ", "")?cap_first >
|
||||||
${countryOpts[key]?uncap_first?replace("the ", "")?cap_first}
|
<option value="${countryName}" <#if countryName == countryValue>selected</#if>>
|
||||||
|
${countryName}
|
||||||
</option>
|
</option>
|
||||||
</#list>
|
</#list>
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue