Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Default values

Felice Ostuni edited this page Mar 18, 2015 · 5 revisions

DataForm/Edit supports insertValue() and updateValue() to prefill values on creation and modify. there is also an "auto" field type that works directly on model, without output.

//default checked checkbox (on creation)
$edit->add('visible','Abilitato','checkbox')->insertValue(1); 

//default values for hidden fields
$edit->add('parent_id', '', 'hidden')->insertValue($parent_id);
$edit->add('updated', '', 'hidden')->updateValue(date());

//default values for auto fields
$edit->add('parent_id', '', 'auto')->insertValue($parent_id);

//set a value directly on model without using output
$edit->set('parent_id', $parent_id, $insert = true, $update = true)
Clone this wiki locally