dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #05717
Re: Custom code for setting default value for Yes/No Data element in Event Capture forms
Hi Sam,
in this case I would have used the data element type "Yes Only". This will
"default" to no / answer and present a check box. This will be equivalent
to what you are doing - remember that even if you set the drop-down to No
the system will not save a "No" to the database, as that requires the user
to actually select No.
regards,
Lars
On Wed, Nov 12, 2014 at 10:55 AM, Sam Kasozi <kasozis@xxxxxxxxx> wrote:
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References