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 -->
</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>
<v:input type="text" label="Start Year ${requiredHint} ${yearHint}" id="startYear" size="7"/>

View file

@ -46,11 +46,14 @@ var customForm = {
this.baseLabelText = this.labelFieldLabel.html();
// Label field for new individual being created
// this.newIndLabelFieldLabel = $('label[for=' + $('#newIndividualLabel').attr('id') + ']');
// this.newIndBaseLabelText = this.newIndLabelFieldLabel.html();
this.newIndLabel = $('#newIndLabel');
this.newIndLabelFieldLabel = $('label[for=' + this.newIndLabel.attr('id') + ']');
this.newIndBaseLabelText = this.newIndLabelFieldLabel.html();
this.or = $('span.or');
this.cancel = this.form.find('.cancel');
this.placeHolderText = '###';
},
@ -133,6 +136,8 @@ var customForm = {
this.typeSelector.attr('disabled', 'disabled');
this.relatedIndLabel.attr('disabled', 'disabled');
this.setLabelFieldLabels();
this.form.submit(function() {
// Re-enable these fields so they get submitted, since they are required
// in the edit config.
@ -320,14 +325,15 @@ var customForm = {
},
setLabelFieldLabels: function() {
// var newLabelTextForNewInd;
var newLabelTextForNewInd,
selectedTypeName = this.getSelectedTypeName();
this.labelFieldLabel.html(this.getSelectedTypeName() + ' ' + this.baseLabelText);
// if (this.newIndLabelFieldLabel.length) {
// newLabelTextForNewInd = this.newIndBaseLabelText.replace('X', this.getSelectedTypeName);
// this.newIndLabelFieldLabel.html(newLabelTextForNewInd);
// }
this.labelFieldLabel.html(selectedTypeName + ' ' + this.baseLabelText);
if (this.newIndLabel.length) {
newLabelTextForNewInd = this.newIndBaseLabelText.replace(this.placeHolderText, selectedTypeName);
this.newIndLabelFieldLabel.html(newLabelTextForNewInd);
}
},