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

Troiscent
Troiscent

Hello,

I'm building a plugin thanks to the excellent builder plugin.

Some of fields in my form are just here for trigger events and I don't need to register the information in a database column.

Is there a way to add a field without saving it in the database ? Because actually, when I try to save my form I get an error :

alex_shop_options has no column named subproducts

Subproduct is one of the field that is just here to display more fields if checked, I don't need to create a database column to register if checked or not.

I looked at all the options of the builder plugin for that fields, it seems there is no way to not link it with a database column, but maybe there is a simple way to do that without the builder, I'm here for expert advices ^^

Thanks

Alex

Eoler
Eoler

Troiscent said: Is there a way to add a field without saving it in the database ?

Yes there is - it's called Purgeable trait: https://octobercms.com/docs/database/traits#purgeable

Troiscent
Troiscent

Ahhh thanks, it's exactly what I'm looking for !

alxy
alxy

You can also prepend fields, that should not be saved to the database, with an underscore in your fields.yaml:

_subproducts:
   label: Show subproducts

You won't even need the Purgeable trait in this case.

Troiscent
Troiscent

Ahh, good to know, thank you for the tip

1-5 of 5

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