NIHVIVO-193 On step 1 of position history form, don't show Continue button. Instead, bind the event listener that opens the rest of the form to a selection from the org drop-down.

This commit is contained in:
rjy7 2010-04-04 22:56:35 +00:00
parent f2a9ddd219
commit 5f428364a2

View file

@ -66,12 +66,14 @@ var customForm = {
this.form = $('#content form'); this.form = $('#content form');
this.button = $('#submit'); this.button = $('#submit');
this.or = $('span.or');
this.requiredLegend = $('#requiredLegend'); this.requiredLegend = $('#requiredLegend');
// These may need to be changed to classes rather than ids, if there are // These may need to be changed to classes rather than ids, if there are
// multiple sets of divs to show/hide during the workflow. // multiple sets of divs to show/hide during the workflow.
this.addNewLink = $('.addNewLink'); this.addNewLink = $('.addNewLink');
this.existing = $('.existing'); this.existing = $('.existing');
this.existingSelect = this.existing.children('select');
this.addNew = $('.new'); this.addNew = $('.new');
this.entry = $('.entry'); this.entry = $('.entry');
this.existingOrNew = $('.existingOrNew'); this.existingOrNew = $('.existingOrNew');
@ -149,12 +151,14 @@ var customForm = {
customForm.addNew.hide(); customForm.addNew.hide();
customForm.entry.hide(); customForm.entry.hide();
customForm.requiredLegend.hide(); customForm.requiredLegend.hide();
customForm.button.val('Continue'); customForm.button.hide(); customForm.or.hide();
// Assign event listeners // Assign event listeners
customForm.button.bind('click', function() { customForm.existingSelect.bind('change', function() {
customForm.doAddFormStep2(customForm.views.SELECT_EXISTING); if ($(this).val() != '') {
return false; customForm.doAddFormStep2(customForm.views.SELECT_EXISTING);
return false;
}
}); });
// Note that addNewLink event listener is different // Note that addNewLink event listener is different
// in different views. // in different views.
@ -177,7 +181,10 @@ var customForm = {
default: { fn = this.doAddFormStep2Combined; break; } default: { fn = this.doAddFormStep2Combined; break; }
} }
fn.call(customForm); fn.call(customForm);
customForm.button.show();
customForm.or.show();
}, },
// Most methods below use 'customForm' rather than 'this', because 'this' doesn't reference // Most methods below use 'customForm' rather than 'this', because 'this' doesn't reference
@ -259,6 +266,7 @@ var customForm = {
customForm.button.unbind('click'); customForm.button.unbind('click');
customForm.addNewLink.unbind('click'); customForm.addNewLink.unbind('click');
customForm.close.unbind('click'); customForm.close.unbind('click');
customForm.existingSelect.unbind('change');
}, },
clearFormData: function() { clearFormData: function() {