User created forms SimpleSchema


#1

Is it possible to let users specify the form fields and then allow them to store it in a collection using SimpleSchema in a dynamic way. I want to create an app where one can specify the data they wan t to collect.


#2

Hi @digitalx778,

This itself is quite simple. Just have a collection with a field ‘forms’ or something. Then set it to be an array of objects. Then put in the blackbox capability on this field. So you should have something into which you can save an object with several properties.

If you are using blaze, this is awesome because now you can hook up @aldeed’s Autoform and then can generate forms off the back of whatever stored data the user has given you.

I don’t use blaze, and (tbh i don’t know) I don’t think anything similar exists for React. But you could always build a few custom components to make the forms off the back of user stored information.

Tat


#3

I am using blaze. Thanks for the reply. I think I was heading down the right path. Could you elaborate a bit more (noob here). What do you mean by blackbox capability?


#4

Have a look at this thread. Thanks so much.

Tat


#5

What do you mean by this? I read up on blackbox still unsure of it. Do you have to create an object say:

var fields= {
“firstName”: {
type: String
},
“lastName”: {
type: String
}
And now I want to place it in as a SimpleSchemaBut how are you suppose to reference the object in SimpleSchema. Since it is not of type SimpleSchema but how can I place this object in the schema and let autoform render it…


#6

I did a demo some time ago with aldeed:autoform with this very technique:

Sidenote: for React you can use the excellent uniforms package: https://github.com/vazco/uniforms which comes with bootstrap3+4 and semantic-ui templates, but it’s also really good to roll your own form-ui.


#7

Nice, this is exactly what I want to implement!. Meteor is cool but the community is also helpful… I will be using blaze not focused on react right now.