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:

    <column headerLabel="SL Knz">
      <checkBox column="SL_KNZ" checkedValue="1" uncheckedValue="0"/>

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

asked 10 Feb '14, 06:01

Marius's gravatar image

accept rate: 0%

Set database column with default value!!!


answered 10 Feb '14, 06:29

haattila's gravatar image

accept rate: 0%

The DB column is defined with 0 as default value! This seems to be overridden by Formspider with submitting NULL as explicit value for the column.

(10 Feb '14, 06:35) 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:

  • created domain with Name "unselectedChkBoxDomain", Data Type "VARCHAR2" Length 1 and Default Value 0
  • edited datasource definition -> Columns -> SL_KNZ and set Domain to the newly created "unselectedChkBoxDomain"

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.


answered 12 Mar '14, 05:17

Marius's gravatar image

accept rate: 0%

edited 12 Mar '14, 05:18

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 10 Feb '14, 06:01

Seen: 2,173 times

Last updated: 12 Mar '14, 05:18

© Copyright Gerger 2017