4 months ago

Dynamic form and save to database

Posted 4 months ago by trifek

Hi. I have a small question. Suppose I have a product (products table) consisting of columns: name, net price, VAT rate, description, product type (cars, bicycles, buses). I made a module that allows you to add new fields to individual types of products (product_features table) consisting of columns: name, product_id, feature_id (feature id), description.

Depending on the selected product type field (i.e. these cars, bicycles, buses) in the CMS panel additional features fields will be visible. How would you do such a dynamic form (I mean writing to the database and building the form)?

I wonder what names to give the input to be able to saving correctly afterwards (the form will be dynamic, so at the start it is not known what fields will be).

How would you see something like this? Thank you in advance for your help :)

Please sign in or create an account to participate in this conversation.