FormBuilder out of Contentblocks?

I’m playing around with the idea to use a nested layout with a couple of chunk-based form elements (input text, etc) as simple form builder.

Not sure about caching an render hierarchy though.

Is it worth following this road, or should I avoid that rabbit hole?

Regards,
pepebe

It is definitely a rabbit hole, but it’s up to you if you want to dive into it. :wink:

There’s this, but it hasn’t been updated in a while.

We successfully used CB with Formit to provide users with form builder, including single and two-column form layout, text fields, textareas, radio groups, checkbox groups, file upload fields, dropdowns, email notifications, autoresponders etc. Initial setup is quite complicated, you need to understand quite well CB, Formit and MODX itself. But in the end of the day, customer is happy :wink:

1 Like

I was also dabbling with that idea some time ago, but then decided to extend my contact-form-element to a “Multi-Purpose” Contact-Form, which is a “very light” Form-Builder:

The editor can choose which fields should be activated, and which fields should be required (via “Multi Select Fields”):

Inside the FormIt-configuration, I set them something like this:

Maybe someone finds that inspiring :slight_smile:

1 Like

Considerung that a full fledged form builder will be overkill for many end-users, your solutionis is nailing it! Thanky for sharing.

1 Like

You’re very welcome - I wish you a lot of fun :smiley:

If you encounter any problems, or want to share some neat tricks, I’m looking to reading back from you :wink:

1 Like

Update: I’ve decided to dive into the rabbit hole and see what happens.

On the backend side I have a simple form builder based on:
A layout field (form) limited to a single layout (fieldset). Inside each fieldset layout you can add one or more formfields (type: chunk, because I needed the preview feature).

Important: The contentblock templates are only used on the backend to create a visual representation of the formfields.

Right now the backend looks like this:

Field settings are managed by a popup:

All the frontend stuff (layout, validation, etc) is created by formit and a renderHook that collects all fieldsets and formfields by parsing the json output from a cbGetFieldContent snippet aimed at the current cb layout and its child elements.

So far I have only the visuals, next are validation and form values.

.

Regards, Patrick

1 Like

Very nice, thanks for sharing!