← Back to team overview

dhis2-users team mailing list archive

Custom code for setting default value for Yes/No Data element in Event Capture forms

 

Hi all,

I have data elements of value type: 'Yes/No' with the attributes below:
What would be the custom form code for setting the default value at runtime
to 'NO'?

<select id="bEGgpe8yxet-vwt4lpdqcbz-val" name="vwt4lpdqcbz"
...
class="ng-binding">[Please Select]</option><option value="false"
class="ng-binding">NO</option><option value="true"
class="ng-binding">YES</option></select>

The Jquery code below works with ordinary select fields; however, for the
field above, it doesn't seem to work.

$(select option:contains("NO")').prop('selected',true);

regards,

Sam Kasozi
Information Systems Consultant
HISP Uganda | GHSI - Uganda MOH - PH Emergency Operation Center
+256 788 993565 | +256 757 662752
kasozis@xxxxxxxxx | skasozi@xxxxxxxxxxx <kasozis@xxxxxxxxx> | Skype:
sam.kasoziug

Follow ups