Subject: | create_from_form puts SQL nulls in unset fields |
Assume you have a table where some of the fields have default values and the 'not null' constraint. Normally you can ignore them when you insert tuples - the server will fill them in with default values. Unfortunately create_from_form puts an undef into *every* field, even the ones which are not present in the form - these are treated by DBI as explicit null values, so the server rejects the transaction due to the constraint violation.
This should be easy to fix - instead of calling $results->valid($col), call $results->valid in array context and iterate over the list. If the caller wanted an undef then they would have specified the field to Data::FormValidator and set the missing_optional_valid option, which populates the list of valid fields with undefs as needed.