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

Mathilde Escher Stiftung
Mathilde Escher Stiftung

Hello, So I bought this calendar plugin: https://octobercms.com/plugin/kurtjensen-mycalendar

Eveything looks fine but the recurring data widget doesn't work. So on my way to debug the plugin a bit, I did a die($value); and then a dd($value); inside it's getSaveValue function. On save nothing happend, but it just normally saved my event, without dumping anything.

The documentation says this: "When the time comes to take the user input and store it in the database, the form widget will call the getSaveValue internally to request the value. To modify this behavior simply override the method in your form widget class."

Is it possible that this function getSaveValue is deprecated or am I wrong somewhere?

daftspunky
daftspunky

Hey Mathilde,

The logic is more strict in v2 where form widgets must contribute to the postback data, otherwise, the form assumes that you don't want to save anything. This has many benefits and overall it is more aligned with standard HTML inputs.

This means if your form widget does not pass its data using the standard field name, it may not be included in the getSaveValue output. Take a look at the following commit for patch instructions: https://github.com/rainlab/sitemap-plugin/commit/d12fed2287ff87dab47d591f116cdd7fb5afb6d8

Include an empty pointer to tell the form that you want this widget included:

<input type="hidden" name="<?= $this->getFieldName() ?>" value="" />

I hope this helps!

Mathilde Escher Stiftung
Mathilde Escher Stiftung

Hey daftspunk,

Yes, thanks! That helped a lot. Now the widget data is saved properly.

1-3 of 3

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