medic / cht-user-management

GNU Affero General Public License v3.0
3 stars 1 forks source link

Gender form input should be a dropdown instead of freetext field #55

Closed kennsippell closed 3 months ago

kennsippell commented 5 months ago

Sex should be a drop down with just male and female

https://github.com/medic/cht-user-management/pull/40#issuecomment-1931829645

inromualdo commented 4 months ago

I propose removing this type and replacing it with a select_one type. This not only addresses the gender issue but also enables the selected items to be transformed into a dropdown. The parameter will be an object with key = select-option value and value = label.

@kennsippell

kennsippell commented 4 months ago

Sounds good @inromualdo! Interested to learn which of these tests will work after the change. If we break a few, I think that'd be okay - let's just be clear on what the new select_one (or just select?) interface supports when data comes from CSVs,

This may also be useful for @paulpascal to address this feedback.

inromualdo commented 4 months ago

It could just be select. I initially used select_one, thinking we might add select_multiple later. However, in the contact creation forms across several projects, I haven't seen any multiple-choice elements. So, we can simply stick with select.

It would look like this:

Screenshot 2024-03-12 at 2 19 22 PM

Either options are added directly in the configs (Gender) or in a separate CSV file (Level Of Study).

Screenshot 2024-03-12 at 2 27 54 PM

After the change, all gender tests will fail unless we leave the type gender and add the select type alongside it.

The genarated html will be:

Screenshot 2024-03-12 at 2 36 16 PM
paulpascal commented 4 months ago

@inromualdo , we will have select multiple with roles (related #86 )

kennsippell commented 4 months ago

How many levels of study are there? Interested in why you're thinking a csv is needed here since parameter already supports array[] (eg. "parameter": ["one", "two", "three"])

After the change, all gender tests will fail unless we leave the type gender and add the select type alongside it.

Gender supports some weird cases like mapping F > Female and Woman > Female. I doubt those would be easily handled by this select_one type.

inromualdo commented 4 months ago

How many levels of study are there?

This is just an example. Here, there is 5. But in the CIV project we have a select_one with more than 200 items.

parameter already supports array[]

In this example, I use object, so that I can display a friendly label

I doubt those would be easily handled by this select_one type

Those would be handled.