Button Group asking for value on editing even if checked

Button Group asking for value on editing even if checked

  

Hello!!


I´m building a mobile app with some screens, and one of them have two button groups.

I´m able to store and retrieve values successfully (when I retrieve the respctive button is checked accordily).

These two widgets are mandatory in the screen.

The problem is: when i´m inserting a new record, inside the button group widget all buttons are unchecked, so the user needs to choose one, if not the validator shows the "Required Field".

But if I´m editing, the button comes checked with the value, and if the user do not need to change it, he will not click again. But at this time, when he tries to save, the message "Required Field" appears again and he is not able to save.


Is there any tip for this or I´m doing somethin wrong?


Thank you!!!


Hi Thiago. Can you share your espace so we can take a look?

João Melo wrote:

Hi Thiago. Can you share your espace so we can take a look?

Hi João!

What exactly do you mean with that?

Some code and/or prints?

Hi,

For button group the best way to bind button group from your static entity and maintain the type of data in static entity.


Thanks!

Solution

Hi Thiago Caixeta,

I also came accross this same situation and I handled the case as mentioned below...


- Requirement states that the button group widgets is mandatory i.e. either one of the ButtonItem should be selected by default or the ButtonGroup Variable should not be empty.


Case 1:  New Record

- Assign a default value to ButtonGroup variable

let us assume that we have two buttons 

1) Button_A 

2) Button_B 

ButtonItems within ButtonGroup and the variable mapped with ButtonGroup is ButtonItemValue. Initially assign the ButtonItemValue = A before the screen is rendered so that On ButtonGroup widget rendering the Button_A get automatically selected as the ButtonItemValue = A which means is Mandatory = True is satisfied i.e. Required field message will not get displayed.

In the real project what I did was I binded the ButtonGroup variable with a entity attribute and under screen I introduced the aggregate with the same entity and assigned OnAfterFetch Aggregate event in which I introduced a IF condition with a check whether it's Case 1 or 2 (i.e. New Record Or Edit Record) and if Case 1 assign the ButtonGroup variable value with default value otherwise direct the flow to end node.


Case 2: Edit Record

In Aggregate OnAfterFetch event after IF condition check if it's case 2 direct the flow to end node i.e. value from table is assigned to the ButtonGroup which leads to selection of ButtonItem and hence the Mandatory = True is satisfied.


Hope that you understood my explanation. Let me know if you need any further help


Kind Regards,

Benjith Sam

Solution

Hello all, thank you very much.


Problem solved!!!