← Back to team overview

dhis2-devs team mailing list archive

Making use of renderOptionsAsRadio property of Option Sets in custom forms.

 

​Hi,

This query is regarding Event Capture app.

HISP Sri Lanka has a requirement of rendering a set of radi​o buttons,
instead of a <select>(or ui-select) for an option set in a custom form.

We have noticed that in defaultForm.html, this case has been handled by
utilizing the property *renderOptionsAsRadio.* But when it comes to
customForms, it just ignore this property.

We tried to manually edit the source of custom form and embed a <d2-radio>
instead of the auto generated <input>. In that attempt, rendering works
fine (visually) but, buttons were not functional since the signature of the
callback function (*d2-callback-function*) of <d2-radio> is not compatible
with the *saveDatavalue *function of the angular controller of custom
form(Or this callback doesn't work at all).

However, <d2-radio-button> directive works fine since the signature of its
callback (*dh-click*) is compatible with *saveDatavalue  *function*.
(ie. **saveDatavalueRadio(eventGridColumn,
currentEvent, value)**)*

I tried to port the logic in defaultForm.html to custom form, but couldn't
find the implementation of d2-custom-form directive in dhis2 repositories.

Could someone please let me know, how we can properly render radio buttons
for an option set in custom forms or please let me know, where can I find
the implementation of d2-custom-form, so I can edit that to handle
*renderOptionsAsRadio* property of option sets.

Thanks,
Chathura
HISP Sri Lanka