Hi, I have some columns in my database table with check constraints, which do not allow NULL values. Now I want to use e.g. a checkbox to set the value of this DB column:
When I create a new row in the datasource, fill some (other) columns with values and commit the changes to the database, I get a check constraint violation error, because an unchecked and never touched checkbox in a new row does not submit the uncheckedValue (ie. 0), but NULL! To really get the 0 submitted, I have to check and uncheck the checkbox. This may be a desired behavior in some cases, but is there a way to submit the 0 without checking and unchecking again? Advanced question: Is there any chance to make Formspider analyse and use my DB table's default values (even "automatically")? Thanks in advance, Marius |
Okay, I found out by myself. I had to create a domain with a default value and assign this to the datasource definition's column. In my case:
Now a new row gets the default value 0 and sends this to the database, even if i never touch the checkbox. As soon as I check or uncheck the checkbox, the correct value from checkedValue="1" or uncheckedValue="0" is submitted. |