I have a form which sits at the supervisor contact profile and in that form, I would like to display a multi-select list of CHVs under that particular supervisor.
I am accessing this form while logged in as a supervisor.
How can I achieve this in CHT? I am looking for an example to guide me through this scenario.
Once selected, the chw_area field will hold the uuid of the place. The hidden field name will be automatically populated to store the name of the place.
We generally have single contact type person for people at all levels, so if we use db:person, we will get the list of all people within the supervisor’s place, including the supervisor.
If you have specified a different contact type for just CHVs, you can use that to get the list of CHVs.
Hey @iesmail that functionality is not currently supported, as mentioned above. I gather that what you want to achieve is to dynamically pre-load CHVs data into the form.
A possible static workaround you could attempt to achieve that is by using pulldata(), supported via XPath. It is static because you define the .csv the same way you do other media support files and would have to be manually updated with the details of the CHVs. However, this comes with other challenges such choice filtering since data does not physically exist in the form, among others.
An easier similar approach would be to define the choice list of CHVs in the choices worksheet.
I would suggest the select_one approach explained in the comment above and work around the multiple aspect using supported functionality like repeats.