Skip to content

Commit

Permalink
Bug fix. Set sequence number only when associatiated vaccination is s…
Browse files Browse the repository at this point in the history
…elected
  • Loading branch information
Ken Omondi authored and Ken Omondi committed Oct 31, 2016
1 parent 4a1cfb0 commit bcce12a
Showing 1 changed file with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,36 @@

MyApp.ui = {
enableAssociatedFields: function (rowObject){
rowObject.find('input:text').removeAttr('readonly').removeClass('disabled');

var hiddenVaccineSequenceNumberField = rowObject.find('input.hVaccineSequenceNo');

rowObject.find('input:text').removeAttr('readonly').removeClass('disabled').each( function() {

var textInputField = $(this);

if( textInputField.parents('span:first').is('.sequenceNo') ) { //Set value for sequence number field from the hidden sequence number field value

textInputField.val(hiddenVaccineSequenceNumberField.val());

textInputField.change();

}

} );

},

disableAssociatedFields: function (rowObject){
rowObject.find('input:text').attr('readonly', 'true').addClass('disabled').each( function() {

var textInputField = $(this);

if( !textInputField.parents(':first').has('.sequenceNo') ) {
if( !textInputField.is('.hVaccineSequenceNo') ) { //Clear values from all fields apart from the hidden vaccine sequence number field

textInputField.val('');

textInputField.change();

}

if( $(this).is('.hasDatepicker') ) {
Expand Down Expand Up @@ -296,7 +314,8 @@
<td style="border-right:none">{vaccineLabel}</td>
<td style="border-left:none">
<obs conceptId ="984" answerConceptId="{vaccineConceptId}" answerLabel="" showDate="true" id="{id}" class="vaccineConcept controlConcept"/>
<obs conceptId="1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" size="3" defaultValue="{vaccineSequenceNo}" class="sequenceNo"/>
<obs conceptId="1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" size="3" class="sequenceNo" id="{id}SequenceNo"/>
<input type="hidden" name="{id}hVaccineSequenceNo" class="hVaccineSequenceNo" value="{vaccineSequenceNo}" />
</td>
<td>
<obs conceptId="1420" size="7" />
Expand Down Expand Up @@ -368,7 +387,8 @@
<td colspan="2">{caption}</td>
<td>
<obs conceptId="1282AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" answerConceptId="86339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" showDate="true" answerLabel="" class="controlConcept vitA dateGiven" id="vitaA-{n}"/>
<obs conceptId="1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" size="3" defaultValue="{sequenceNo}" class="sequenceNo"/>
<obs conceptId="1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" size="3" class="sequenceNo" id="{id}SequenceNo"/>
<input type="hidden" name="{id}hVaccineSequenceNo" class="hVaccineSequenceNo" value="{sequenceNo}" />
<span id="vitA-given">
<obs conceptId="161534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" style="checkbox" answerLabel="Yes" answerConceptId="1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" class="vitAGivenYes" />
<obs conceptId="161534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" style="checkbox" answerLabel="No" answerConceptId="1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" class="vitAGivenNo" />
Expand Down

0 comments on commit bcce12a

Please sign in to comment.