Skip field
Created 6 years ago by czorny813

Hi,

How set value in field (skip field) in controller to my form when create item in DB.

Thanks.

ryanthompson  —  6 years ago Best Answer

Just set it onSaving in your builder. Just like pages module: https://github.com/anomalylabs/pages-module/blob/2.3/src/Page/Form/PageFormBuilder.php#L59

I think there is now even a setFormEntryAttribute($field, $value) available to make things even cleaner looking.

ryanthompson  —  6 years ago

Hey! You can interact with your builder in a number of ways - one of which is setting skips (an attribute) or simply adding one:

$builder->setSkips((array)$fieldSlugs);
$builder->skipField($fieldSlug);

Do this BEFORE calling make/render/build.

czorny813  —  6 years ago

Thanks. I skip the field type relationhip. How i can set value in this field? Something like parent_id in papges-module.

ryanthompson  —  6 years ago Best Answer

Just set it onSaving in your builder. Just like pages module: https://github.com/anomalylabs/pages-module/blob/2.3/src/Page/Form/PageFormBuilder.php#L59

I think there is now even a setFormEntryAttribute($field, $value) available to make things even cleaner looking.

czorny813  —  6 years ago

I'am sorry, i'am try but i'dont know how to use that. Thanks, I will try to effect 😄

czorny813  —  6 years ago

Working! Thanks! 😄