User created forms - Create fields and forms from front end

Is it possible to let users create forms and fields from the front end?

I want users to be able to create their own forms without having to go to the back end.

So they will need to create fields like text fields, multiple choice fields, etc. And then all this should be able to be displayed in a form.

Thank you.

1 Like

Can be done.
I’d do it like this:

Create an option set for the types (multiple choice / single choice / text / others)
I’d create a database type called ‘form_questions’ with a ‘type’ field that holds a value from the option set.

Then you allow the user to create these questions and assign a type to each of them.

While rendering the user’s custom question, create an RG of the relevant questions and for each questions, display the response fields conditionally based on the type.

Hope that helps!

Thanks for the info. I’m glad it can be done. I’ll do a test run and see how I get on.

Also what is RG?

RG = Repeating Group :slight_smile:

Love this approach! Now for the write back to the DB, do you have generic columns as text, answer_1, answer_2, etc. and assign a question to a column?

Or am I missing an easier way to store the answers? I’m halfway through first coffee of the day so not fully booted yet.

1 Like

Maybe have ‘answer’ as another data type that has a field for all these types of answers, and only the relevant field gets updated when you create an answer, depending on the question’s type.

Plus the answer could also have a field for ‘type’ which uses the same option set to populate. This might help while conditionally rendering existing answers that might have been created.

1 Like

Just wanting to check this option set method can only be used for prepolulated choices, that I have already setup in the backend.

If the end user wants to have a custom drop down multiple choice answer to go with a question, then I have to create a table where they can insert their custom choices into. And then display this next to the question.

Hope I’m explaining this properly. Thanks.

Dynamic choices can be done with the same setup, just using the Data Types a little differently.

For example, one approach could be storing the choices on the ‘question’ thing as text fields and using the ‘type’ option set to inform the condition to render the choices accordingly.

Thanks again, I think I understand, let me have a go and see if I can do it.

For dynamic choices to work, I have to have a field to filter them in that same datatype table. So choices can be grouped togther before being displayed. Assuming the end user might have have different sets of dynamic choices for different questions.

Yup

You can have some redundancy built into your data type since it’s not too complex a use case. So I would even build in 4 such fields into the question data type: ‘choice1’, … , ‘choice4’ - all of type text.

This would be what gets displayed with the question if the question’s type (option set) is ‘multiple-choice’. If it’s not ‘multiple-choice’, these fields can remain empty and won’t be used.

Something like that


Cheers,
Ranjit from Atomic Fusion

Explore and reuse the community’s Bubble assets & Accelerate your Bubble development with Atomic Fusion

Excellent, that would make it work. Thanks.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.