Form Best practice for manytomany
alpapan opened this issue · 1 comments
Hello
I seek the knowledge of the developer hive on what would be the 'right' way to implement form input (fields.yaml) for a field that has many to many relationships ($belongsToMany entries) when there are a lot of values to choose from.
-
I currently have only been able to use type: relation. This creates a series of check-boxes which is cumbersome when options go more than a dozen.
-
I tried to use recordfinder (an excellent choice use for screening through large number of entries - when using a 'one to many' relationship) but it does not work/is not supported for many to many.
-
I also tried being creative by using recordfinder within a type:repeater but force-using the many to one relationship. It returned a json which I tried to parse (within beforeValidate) to be compatible with the many-to-many database structure but it became too complicated when dealing with the SQL commands.
So what would be the recommendation?
many thanks and happy new year!
a
Use the RelationController: https://octobercms.com/docs/backend/relations. Also, please don't open issues on the docs repo unless they're actually about the docs themselves.