Added some more Javascript behavior to edit version of custom forms.

This commit is contained in:
rjy7 2010-04-15 19:53:18 +00:00
parent d255909f3b
commit 40990255c7

View file

@ -257,6 +257,16 @@ var customForm = {
default: { fn = this.doEditFormCombinedView; break; }
}
// Remember the original org. If we click the add new org link
// but then cancel out of it, we want to restore this value.
this.originalOrg = this.existingSelect.val();
// But we only want to restore the original value from when the
// form loaded. If we've already changed to a new value, we don't
// want to restore that.
this.existingSelect.bind('change', function() {
customForm.originalOrg = null;
});
fn.call(customForm);
},
@ -357,6 +367,11 @@ var customForm = {
customForm.button.val(customForm.defaultButtonText);
customForm.doAddNewLinkForCombinedView();
customForm.setReturnView(customForm.views.COMBINED);
if (customForm.originalOrg) {
customForm.existingSelect.val(customForm.originalOrg);
}
return false;
});
},