This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have a form widget that displays data about specific model when you edit it and visible only on the update page,
but when I set it in the fields.yaml file I get errors when I save the model (both create and update) that say the field name column could not be found (Column not found: 1054 Unknown column 'xxxxx' in 'field list'
) and the model is not saved.
How can I set it to be read only and not send it when saving the form?
Last updated
If i'm understanding you correctly, you are trying to have the form widget display, but not send any data? This should do the trick, first import this class at the top of your widget file
use Backend\Classes\FormField;
Then stick this function somewhere in the widget class
public function getSaveData($value)
{
return FormField::NO_SAVE_DATA;
}
Last updated
ilan3853, just a heads up getSaveData
has been deprecated as of build 181. You should change your code to this instead.
public function getSaveValue($value)
{
return FormField::NO_SAVE_DATA;
}
1-5 of 5