This is where you have a checkbox whose value is set by the result of a database query, when that database boolean field contains a value of 1.
Expected Behaviour
If you reload the database query via a server connect, the checkbox is still checked.
Actual Behaviour
The first time the server connect is run, the checkbox is checked.
Subsequent times the server connect is run, the value returned by server connect is still 1 but the checkbox is now shown unchecked.
How to Create
Create a mysql database table with a field boolean_field of type boolean.
Create a server action and server connect test_checkbox to access that field.
Create a checkbox to display the value of boolean_field
Add a button to load the server connect.
Set the value of the boolean_field to 1 in the database
View the page.
Click on the button to load server connect test_checkbox
The check box is checked.
Click on the button to load server connect test_checkbox again.
The check box is no longer checked.
Here is the code my example used for displaying the checkbox:
I just clicked the load server connect button multiple times.
The first time I click it the checkbox is checked correctly.
Every time I click it after that the checkbox is unchecked, even though I can see from the chrome dev console that test_checkbox.data.test_checkbox.boolean_field still has a value of 1.
If you didn’t uncheck the checkbox then it should stay checked after a reload of server connect. Did a small test here and it stayed checked.
The problem with form fields is that they also have an internal state. When you add an expression with dmx-bind, then app connect watches that expression and will update the attribute when the value changes. In your case the old value was true and the new value is also true, so it doesn’t update the component. When you unchecked the checkbox in the browser, it updates the internal state, the attribute will still be the same.
I think a solution could be to reset the form before updating it, then the inputs reset to their initial state.
In the last Wappler update (RC2) I fixed some issues with reset of checkboxes.
To get new updated files you need to open a file with app connect on it and save it again, on save it will copy the new updated app connect files to your project.