NIHVIVO-630 Javascript modifications for modifying field label text based on type selection in roles form

This commit is contained in:
rjy7 2010-07-15 15:01:40 +00:00
parent 536bfd72bc
commit ffbb917e40
2 changed files with 16 additions and 10 deletions

View file

@ -338,7 +338,7 @@
<input type="hidden" id="roleActivityURI" name="roleActivity" class="acReceiver" value="" /> <!-- Field value populated by JavaScript --> <input type="hidden" id="roleActivityURI" name="roleActivity" class="acReceiver" value="" /> <!-- Field value populated by JavaScript -->
</div> </div>
<p><v:input type="text" id="newIndLabel" name="roleLabel" label="Role ${requiredHint}" size="50" /></p> <p><v:input type="text" id="newIndLabel" name="roleLabel" label="Role in ### ${requiredHint}" size="50" /></p>
<h4>Dates of Participation</h4> <h4>Dates of Participation</h4>
<v:input type="text" label="Start Year ${requiredHint} ${yearHint}" id="startYear" size="7"/> <v:input type="text" label="Start Year ${requiredHint} ${yearHint}" id="startYear" size="7"/>

View file

@ -46,12 +46,15 @@ var customForm = {
this.baseLabelText = this.labelFieldLabel.html(); this.baseLabelText = this.labelFieldLabel.html();
// Label field for new individual being created // Label field for new individual being created
// this.newIndLabelFieldLabel = $('label[for=' + $('#newIndividualLabel').attr('id') + ']'); this.newIndLabel = $('#newIndLabel');
// this.newIndBaseLabelText = this.newIndLabelFieldLabel.html(); this.newIndLabelFieldLabel = $('label[for=' + this.newIndLabel.attr('id') + ']');
this.newIndBaseLabelText = this.newIndLabelFieldLabel.html();
this.or = $('span.or'); this.or = $('span.or');
this.cancel = this.form.find('.cancel'); this.cancel = this.form.find('.cancel');
this.placeHolderText = '###';
}, },
// Set up the form on page load // Set up the form on page load
@ -133,6 +136,8 @@ var customForm = {
this.typeSelector.attr('disabled', 'disabled'); this.typeSelector.attr('disabled', 'disabled');
this.relatedIndLabel.attr('disabled', 'disabled'); this.relatedIndLabel.attr('disabled', 'disabled');
this.setLabelFieldLabels();
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.
@ -320,14 +325,15 @@ var customForm = {
}, },
setLabelFieldLabels: function() { setLabelFieldLabels: function() {
// var newLabelTextForNewInd; var newLabelTextForNewInd,
selectedTypeName = this.getSelectedTypeName();
this.labelFieldLabel.html(this.getSelectedTypeName() + ' ' + this.baseLabelText); this.labelFieldLabel.html(selectedTypeName + ' ' + this.baseLabelText);
// if (this.newIndLabelFieldLabel.length) { if (this.newIndLabel.length) {
// newLabelTextForNewInd = this.newIndBaseLabelText.replace('X', this.getSelectedTypeName); newLabelTextForNewInd = this.newIndBaseLabelText.replace(this.placeHolderText, selectedTypeName);
// this.newIndLabelFieldLabel.html(newLabelTextForNewInd); this.newIndLabelFieldLabel.html(newLabelTextForNewInd);
// } }
}, },