phreeze icon indicating copy to clipboard operation
phreeze copied to clipboard

Required values not fire error message on save

Open xzegga opened this issue 10 years ago • 1 comments

I am generated a phreeze app with a database with some not null fields, I am using PDO as MySql Driver, In app generated, when I add a new record without fill any not null field in the database, the app save without problem an empty record.

What can I do to validate a not null fields in the app?

xzegga avatar Feb 17 '15 06:02 xzegga

The controller file is what is doing that because for a web form it doesn't ever pass in NULL - it just passes in an empty string. So it's setting your columns to empty string and they are allowed to be inserted. You can handle it in various ways - you can put in validation code in the model, or the easy approach is to just check those values in the controller and throw an error if they're blank.

jasonhinkle avatar Feb 17 '15 17:02 jasonhinkle