[Solved] AutoForms with User Defined Schema


#1

HI All,

I’m trying to do the following:

  1. User defines a schema.
  2. Save the schema to the db.
  3. Use AutoForms to generate form on the fly when user selects relevant Schema.

tl, dr: Is this possible?

Longer version: This is where i have got too. The exact error I’m getting is a validation error, which is confusing me.

Collection Schemas:

Collection Forms:

The point is, i can save a schema and then reconstruct it as a variable (the fields bit). This i can then pass to a template, like so…

This actually worked really well. Using the ‘test’ below:

I get the following output:

I do not really understand where the form is failing validation? Suggestions most welcome. Note: the idea is that the Submit would save the form into the Forms collection.

Thanks so much.

Tat


Dynamic fields in one schema with autoform?
#2

Hi,

Also, see working on a different schema, just to show that the dynamic generation of schemas and autoforms seems possible.

Note: the schemas.fields.value as 1, 2, 3, and 4 map to String, Number, Boolean and Date. I can fix that up later.

Thanks so much.

Tat


#3

@aldeed - apologies for tagging, but it’s a pretty specific issue with regards to c2 and simpleschema. Not looking for a solution, happy to do leg work myself. Bit stumped as to where the validation issue is coming in from. Pointers would be appreciated.

If its something you think will need you to have a closer look at, please let me know. Will redo in specific project and stick on github to make easier.

Thanks so much.
Tat


#4

Hi,

Just for anyone who might look at this in the future.

Solved, am a muppet. The solution was simply to wrap the output of the form with { information: doc}, where doc is the output of fields - this is because i have the information field in my forms schema (duh!).

I did this using a autoform before hook.

Tat


#5

what does dollar sign mean in dot notation? yep im getting an error for it. any chance theres a repo for this


#6

Hi,

Its an array - see this. Tried looking around, but not sure where the repo is bud, sorry.

Thanks so much.

Tat


User created forms SimpleSchema