Javascript fixes for roles/grants/publications forms

This commit is contained in:
rjy7 2010-07-16 14:57:07 +00:00
parent d58b1abdc8
commit cef2fe12b7

View file

@ -93,7 +93,6 @@ var customForm = {
// on a refresh), go directly to full view. Otherwise user has to reselect // on a refresh), go directly to full view. Otherwise user has to reselect
// twice to get to full view. // twice to get to full view.
else if (typeVal.length) { else if (typeVal.length) {
this.setType();
this.initFormFullView(); this.initFormFullView();
} }
else { else {
@ -103,6 +102,7 @@ var customForm = {
initFormTypeView: function() { initFormTypeView: function() {
this.setType(); // empty any previous values
this.hideFields(this.fullViewOnly); this.hideFields(this.fullViewOnly);
this.button.hide(); this.button.hide();
this.requiredLegend.hide(); this.requiredLegend.hide();
@ -117,6 +117,7 @@ var customForm = {
this.initFormEditView(); this.initFormEditView();
} }
this.setType();
this.fullViewOnly.show(); this.fullViewOnly.show();
this.or.show(); this.or.show();
this.requiredLegend.show(); this.requiredLegend.show();
@ -139,9 +140,6 @@ var customForm = {
this.typeSelector.attr('disabled', 'disabled'); this.typeSelector.attr('disabled', 'disabled');
this.relatedIndLabel.attr('disabled', 'disabled'); this.relatedIndLabel.attr('disabled', 'disabled');
this.setType();
this.setLabels();
this.form.submit(function() { this.form.submit(function() {
// Re-enable these fields so they get submitted, since they are required // Re-enable these fields so they get submitted, since they are required
// in the edit config. // in the edit config.
@ -159,11 +157,6 @@ var customForm = {
// If an autocomplete selection has been made, undo it // If an autocomplete selection has been made, undo it
customForm.undoAutocompleteSelection(); customForm.undoAutocompleteSelection();
// Set the type of individual that the autocomplete will search for,
// and the type name for labels and button text.
// We do this even if typeVal is empty, to clear out a previous value.
customForm.setType();
// 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.
typeVal.length ? customForm.initFormFullView() : customForm.initFormTypeView(); typeVal.length ? customForm.initFormFullView() : customForm.initFormTypeView();
@ -339,7 +332,8 @@ var customForm = {
var selectedType; var selectedType;
// If there's no type selector, these values have been specified in customFormData. // If there's no type selector, these values have been specified in customFormData,
// and will not change over the life of the form.
if (!this.typeSelector.length) { if (!this.typeSelector.length) {
return; return;
} }