442
Views
16
Comments
Solved
how to check the values of multiple checkboxes
Application Type
Reactive

I have a form with multiple checkboxes. Each checkbox represents a language, so you can select which language you speak. Ofcourse you can select multiple checkboxes. Each checkbox has it is own local variable and all of the checkboxes are triggering the same client action on change. However in the client action, i do not know how to check which checkbox is selected? For example how can i check if the checkbox with local variable CheckBoxNL2 is selected/is true? Because only the checkboxes which are selected/are true are saved to the database.


I do not think this is possible with a IF statement because there are many checkboxes.

2025-04-17 05-42-16
Ajit Kurane
Solution

Hi Sam,

Here I have created small demo.

You can implement the same with your use case if you like it.

Please find OML file for the same and demo link,

https://personal-xyog61l7.outsystemscloud.com/Sam_Demo/Sam_List?_ts=638083842066284125

Thanks,

Ajit Kurane.

Sam_Demo.oml
2026-02-19 13-54-07
Joao Grilo

Excelent example!
I'd mark this one as the solution!


Best of luck :)

UserImage.jpg
sam m

thank you @Ajit Kurane for you example. I am trying right now to save it to the database. I have placed a Create server action, however it does not save the sleected languages, it is always ID 0 and lablel engels.


i am using a static entity for the languages. How can i save the selected languages to the database? What do i wrong?

2025-04-17 05-42-16
Ajit Kurane

take for each loop and pass selected checkbox list and then createorupdate the same.

Hope it helps you.

Thanks,

Ajit Kurane.

2022-08-03 04-32-50
Ravi Punjwani

What Ajit has mentioned is correct to resolve this issue. However I would recommend creating a separate thread and mark a previous answer as solution to this.

It can be difficult to understand for the future visitors of the forum pages to decide which question does this thread relate to, and which one is the real answer.

Let us all try to keep forum posts easy to understand and limited to the query involved.

I'm sure new posts for the new problem would attract many users in the community to come join and respond to it.

2018-06-05 16-54-03
Maria da Graça Peixoto

Hi! 

You already have a parameter in the action used in the "on Change" that gives the info you need , the "CheckBoxSel ...". 

Just use a "switch" and verify from which "Check box" the action has been called comparing "CheckBoxSel ... " with each value of the Taal entity. 

Regards

Graça 

2022-08-03 04-32-50
Ravi Punjwani

Hi Sam,

Try using a list widget that is bound to a list of languages and each of the item in the list to have its own boolean variable for storing the selection. So the list item type should have 1 boolean, 1 text and 1 integer for storing ID of the language

In the list item, place a checkbox and label for selection and display of language

On checkboxchanged you can find out all language IDs selected using ListFilter client action.

UserImage.jpg
sam m

What do you mean with "each of the item in the list to have its own boolean variable for storing the selection "? Do you mean a attribute inside the language entity? Because how can a list item have it is own variable?

2022-08-03 04-32-50
Ravi Punjwani

Not inside language entity.

The list that you would be binding your widget can be a List of Record (instead of List of an Entity).

List of Record to contain following attributes

- IsSelected (boolean for checkbox selection)

- Entity (containing Language ID and Language Label)

2023-08-28 07-00-10
Paulo Torres
Champion

Better if you have a List with LanguageId field and IsSelected field. With this you know what language was selected.

2026-02-19 13-54-07
Joao Grilo

The better solution is having a field with "IsSelected" and that way you can filter by the ones that are indeed selected. It's for sure the clearer way for future devs to understand your code.

UserImage.jpg
sam m

you mean like a IsSelected boolean attribute in the Language entity right?

2026-02-19 13-54-07
Joao Grilo

Yes. It's the easiest way for you to work with as you can use a simple Assign to set it to true or False and as I stated before, every dev that look at your code will instantly understand what you are doing :)

UserImage.jpg
sam m

and where do i exactly place the assign? Because the checkbox already has its own true/false

2026-02-19 13-54-07
Joao Grilo

Before the server action to create the new record. Using the OnChange you could set the IsSelected attribute to have the value of the checkbox and then create/update the record that you want. If the doubt still remains and if you can, share the OML. Maybe I can help further.

Best of luck :)

2025-04-17 05-42-16
Ajit Kurane
Solution

Hi Sam,

Here I have created small demo.

You can implement the same with your use case if you like it.

Please find OML file for the same and demo link,

https://personal-xyog61l7.outsystemscloud.com/Sam_Demo/Sam_List?_ts=638083842066284125

Thanks,

Ajit Kurane.

Sam_Demo.oml
2026-02-19 13-54-07
Joao Grilo

Excelent example!
I'd mark this one as the solution!


Best of luck :)

UserImage.jpg
sam m

thank you @Ajit Kurane for you example. I am trying right now to save it to the database. I have placed a Create server action, however it does not save the sleected languages, it is always ID 0 and lablel engels.


i am using a static entity for the languages. How can i save the selected languages to the database? What do i wrong?

2025-04-17 05-42-16
Ajit Kurane

take for each loop and pass selected checkbox list and then createorupdate the same.

Hope it helps you.

Thanks,

Ajit Kurane.

2022-08-03 04-32-50
Ravi Punjwani

What Ajit has mentioned is correct to resolve this issue. However I would recommend creating a separate thread and mark a previous answer as solution to this.

It can be difficult to understand for the future visitors of the forum pages to decide which question does this thread relate to, and which one is the real answer.

Let us all try to keep forum posts easy to understand and limited to the query involved.

I'm sure new posts for the new problem would attract many users in the community to come join and respond to it.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.