LearnNewsExamplesServices
Frontmatter
id4526
titleCheckBox Component: get/set value property issue
stateClosed
labels
bug
assignees[]
createdAtJul 4, 2023, 9:51 AM
updatedAtSep 4, 2023, 3:09 PM
githubUrlhttps://github.com/neomjs/neo/issues/4526
authoralberthashani
commentsCount4
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtSep 4, 2023, 3:09 PM

CheckBox Component: get/set value property issue

Closed v8.1.0 bug
alberthashani
alberthashani commented on Jul 4, 2023, 9:51 AM

Checkbox component has an issue with getValue() method. if the value property is set externally to e.g. true, it will persist as true no matter what we set.

getValue logic -> return me.checked ? me.value : me.uncheckedValue

alberthashani added the bug label on Jul 4, 2023, 9:51 AM
alberthashani changed title from CheckBox Component: value set issue to CheckBox Component: get/set value property issue on Jul 4, 2023, 10:00 AM
tobiu
tobiu Jul 4, 2023, 10:25 AM

Hi Albert. We are kind of not supposed to change the value config at run-time, although it is possible.

value means “what do we want to submit in case the field is checked?” which is the same for most use cases.

dynamically changing the checked config will check or uncheck the field.

there is more to it when it comes to checkbox groups. There, the BE will send an array of values and only for included fields will get checked. For this part, take a look into form.Container: setConfigs().

greetings from Munich :)

tobiu
tobiu Jul 4, 2023, 10:29 AM

Thinking more about it: we probably could add a “getGroupValue()” method, in case it helps.

alberthashani
alberthashani Jul 7, 2023, 11:34 AM

Hi Tobi, thanks for the detailed response. Currently we have this issue only with a checkbox in a single context, no groups. Simply put, the checkbox X has a loaded value from the back-end for example: true, when checkbox is clicked it will assign true to it again instead of false, due to the logic in the getValue function. Let's have a call soon, and I can show you what I mean.

alberthashani
alberthashani Sep 4, 2023, 3:09 PM

This is fixed now.

alberthashani closed this issue on Sep 4, 2023, 3:09 PM