Page 1 of 1
Boolean and checkbox
Posted: Fri May 02, 2014 4:04 pm
by Niels
Hello community,
I'm having a problem with booleans and corresponding checkboxes.
I have a boolean in my DB, which I'd like to control directly through a checkbox. I run a create service that gets triggered with a value change of the checkbox.
But instead of changing just the boolean in my data set, it creates a new data set entry or does nothing at all, when unchecking the checkbox.
What am I doing wrong?
Boolean and checkbox
Posted: Sat May 03, 2014 12:04 am
by Illya Stepanov
Hi Niels,
Please can you show us your service settings and mapping?
Boolean and checkbox
Posted: Sat May 03, 2014 12:13 am
by Niels
Boolean and checkbox
Posted: Sat May 03, 2014 12:16 am
by Niels
I should mention that the data is previously read into the form above. Once there, I would like to be able to change the values in the checkboxes (true or false in the DB), so that they will be changed immediately in the DB.
Is that possible?
Boolean and checkbox
Posted: Mon May 05, 2014 1:49 pm
by Evgene Karachevtsev
Hello Niels, sorry for the delay.
For updating your records in appery.io DB you should use update service: http://docs.appery.io/documentation/b...
Boolean and checkbox
Posted: Mon May 05, 2014 5:31 pm
by Niels
Hello Evgene,
the checkbox is still not updating the DB. I mapped the update service as seen above, but the Selected value is not working with the boolean in the DB.
I tried both click and selected as event.
Boolean and checkbox
Posted: Tue May 06, 2014 5:46 am
by Evgene Karachevtsev
Hello, Niels
Are there any errors in the browser console?
Boolean and checkbox
Posted: Tue May 06, 2014 10:52 am
by Niels
Hello Evgene,
yes, there is
{"code":"DBSU252","description":"Invalid value for type 'boolean': 'results_vorrat'."}
I checked the value for the corresponding request, which is string.
Boolean and checkbox
Posted: Tue May 06, 2014 2:46 pm
by Kateryna Grynko
Hi Niels,
To get an appropriate boolean value from checkbox you should change your mapping, delete arrows from checkbox to corresponding parameters in request.
Add JS to those boolean parameters (http://docs.appery.io/documentation/r...). Use code like this: prereturn $("#Screen1_mobilecheckbox_3").prop("checked");/preWhere Screen1 is your page name,
mobilecheckbox_3 is a name of your checkbox component.