Obs Form - click a button to also to set another button

Is there a way to have a button at the top of an obs form select a button lower down in the form (and vice versa)? We would like to have the most common complaint buttons in a group at the top, which would then select the same complaint button in the relevant form section further down.

no “goto” mechanism in forms (Forms 1.0 or Forms 2.0). However, you might want to use something like a “formCondition” to open-up/activate a relevant group/section in the form.

1 Like

thanks for you quick reply, just to clarify, we would just like to select another button with the same name in another section of the form, not go there. so this seems not possible?

unfortunately no! no means of setting focus.

It would not need to get focus, only be set to selected, the idea is the common complaints are all selected at the top, but that also registers them in each relevant section within the form, which is large.

Otherwise the provider has to click the complaint at the top, then find it again in the subsection below and click it a second time. Maybe a form condition can achieve this?

No selection allowed. You can use form conditions to show/enable controls. maybe thats the way to figure this out.

1 Like

Out of curiosity, how easy would it be to support this in a future Bahmni version? (I.e. expose a function that will select/deselect a selectable obs field, and that can be used within a form condition?)

1 Like

What you are actually asking is - on change of state (button-click or value-change), automatically moving to a different focus areas - and this must reflect on the UI screen. For this the screen will have to scroll as well. On the forms 2.0, it should be simple, however the question really is about UX. e.g. change a value and then you are automatically jumped to another section which maybe in towards lower in the page or prev hidden!

On Forms 1.0, I suggest not.

I think that what @ouiliam is saying is that they have a button at the top of the form for “cough”, and if the user clicks this it should also set a different “cough” button to the “checked” state elsewhere on the page, without moving the UI focus. (I’m also having trouble thinking about what verb to use to describe “setting the state to ‘checked’ of a button that behaves like a checkbox”).

I think this is bad style, and leads to duplicate obs, but there could be some legitimate use case I’m missing, and I don’t want to be judgmental
 :slight_smile:

If I’m understanding the request right, it should be possible today with form conditions, using getValue() and setValue(value).

1 Like

Thanks, that describes what we want to do. It is something we want to try out for speed of entry reasons in a long form, to let providers click on common complaints at the top which sets the corresponding button to “checked” state further in the form, without jumping there.

Okay, so this should be doable with the current release, using form conditions. Can you give that a try?

yes, if thats what you want, that should be easily doable. Check documentation here on Form conditions for Forms 2.0.

form.get(‘Number of Packs’).setValue(1);

Now, I don’t think setValue() will work for a button or checkboxes as such! (Especially, the clickable buttons that you see - they only change the class when clicked and an action is triggered for the value change). For that, we might have to add another API like

form.get(‘Number of Packs’).select()

But very much doable.

Hello @angshuonline,

is this feature of getting/setting values in Form 2.0 possible in Form 1.0?

Thanks

Mupagasi

Unfortunately no. :frowning:

1 Like