Ad

OctoberCMS: How To Prevent A Form Filed From Being Saved Into Database?

I've got a form fields definition file like the following:

fields:
    pivot[hall]:
        label: Hall
        type: text
        span: auto

    pivot[booth]:
        label: Booth
        type: text
        span: auto

    booth_picker:
        label: Select Booth
        type: boothpicker
        span: full

The third field is only a form widget which provides a convenient visual way to set the value of booth field. Therefore, I do not need the booth_picker field to be submitted and saved into database because there is no such field in the table. Only hall and booth need to be submitted and saved. I am currently getting this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'booth_picker' in 'field list' (SQL: update users set updated_at = 2016-12-15 13:14:44, booth_picker = where id = 37)"

How can I prevent this helper field from being submitted? Or maybe there is a way of removing this field before the model is saved into database?

Ad

Answer

try to add underscore before your field name (new October Cms feature so perhaps you need to upgrade it to version 382)

like that _booth_picker

edit : im not sure but it seems this feature doesnt work with checkbox field :-(

Ad
source: stackoverflow.com
Ad