This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

ilan3853
ilan3853

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

Scott
Scott

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
ilan3853

Yes, exactly what I need, thank you very much :)

Scott
Scott

You're very welcome, glad I could help :)

Scott
Scott

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

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.