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

Wouter
Wouter

I have created a little time ago a plugin. For the form fields in this plugin i dont use a yaml file because i need costum fields. for example:

<input type="text" name="Wereldkaart[bg_color]" id="Form-field-Wereldkaart-bg_color" class="color {hash:true, adjust:false}" value="#FFFFF" onchange="drawVisualization();" >

When i create this plugin when the name of a field was in this case Wereldkaart[something] it was be saved to the database field something. But now my whole form is ignored only the 2 fields form the yaml file are saved.

Is there something changed in october this did not work anymore ?

Mod note: Edited to use markdown's backtick syntax instead of <pre> tags

Last updated

daftspunky
daftspunky

A form will only save data for the defined fields. It is a security measure so the user cannot simply specify any model attribute they like in the HTML.

You may need to hook the form save event and access your data using post().

Alternatively you could use a partial form field type and specify any markup you like, so long as the name matches the attribute name (bg_color).

Last updated

Wouter
Wouter

I have created a partial before but i did not understand what i have to do more.

How do i let the system know to save the form fields from the partial ? Do i have to set something in Onsave() I cant find how i can access the data from the form fields.

I have now: (dont work)

public function Onsave() {
Db::table('kaarten')->insert(
    ['jscode' => post('bg_color')]
}

Last updated

1-3 of 3

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