I need advice about create complicated forms


#1

Hello.
I made project on Meteor/Blaze. And I use AutoForm and SimpleSchema, which i don’t like, because I can’t do some things with them.
For example tag-input with preload from collection of tags. I tried many ways but it doesn’t work.
Also I had difficulties with add some additional features to the AutoForm (some find-replaces, computation).
I don’t like it anymore, and don’t want spend my time to it. And I can’t use blaze for it because my forms is some complicated, with dynamically added fields, nested arrays etc. I suppose I should use something like “one source of truth”, when first we change some js object and it’s automatically change our form (I imagine how it works in vue/react/angular, but I don’t know how it made in blaze).

And I don’'t want change whole my app, only forms. And leave FlowRouter, BlazeLayouts, blaze templates.

I tried to use this approach Meteor-Vue-Blaze but it don’t work in my app… I can’t find the reason.

Can someone give me a good advice about what should I do?


#2

You probably did something wrong, we use tags input with preloaded tags just fine.

We have very complex forms, with dynamic fields and so on. For more complex things we use Autoform just to generate the fields, and we get the info from the fields ourselves.

Try using template:forms.


#3

may be after last updates it doesn’t work? do you use AutoForm 6.0 with SimpleSchema from npm module?

I need some additional functional, for parse field values…


#4

No, I still use AutoForm 5. Make sure every package that you are using for AutoForm supports the version 6.

Maybe template:forms is a better alternative for you.


#5

thanks a lot. I didn’t hear about it (first i thought that you are talking about some of AutoForm templates). Now I’ll learn it.


#6

Here’s some example code that shows how to create reusable controllers with Blaze if you want to move away from AutoForm:


#7

I think you can do what you want with Blaze and auto-form. it’s very flexible. Maybe post one question at a time and focus on a specific problem and show us what you’ve tried, and you can probably get some specific feedback. But it’s hard to address your problems when they are all combined together–“don’t like”, “doesn’t work”, “can’t do”.

So I think it’s best to start with one problem at a time.


#8

thanks) I’ll think about it. Just when I did like you told:

post one question at a time and focus on a specific problem

I did it here and on stackoverflow and github, but didn’t recive any feedback (

I thought that AutoForm technology overdue , and not supporting more, and now people use things like react, angular and vue.


#9

I don’t suppose you have any examples of this lying around?? I have a large complex form and have some issues with performance when displaying an existing entry. Thanks in advance.


#10

Basically what we currently do in some forms (probably not the best way to do though).

We have a list of inputs (like instalments) and we want to allow users to edit it and then save it.

For example: we need to add fields for every key in every object of an array:

const = [{}, {}, {}];

We store the values in an reactive var, and use an {{#each}} to create the all the fields with {{> afQuickField}}.

It’d defeinitly not the perfect way of doing it.

you have to use the param value= to assign the values of the fields, and have to keep the reactive var as the source of “truth”, so if you want to add another line, you have to add a position to the reactive var…

And the hooks for form submission will not validate these fields.

So, not sure if my example would help you with the best practices.

I think that adding the ‘label’ key to the schema made a little bit faster to render the templates. But it still not as fast as I would like, for a split second the screen is blank, while it loads all the templates.


#11

Thanks for taking the time to reply. Apologies for hijacking the thread.

The issue I am having is that the form is large with dynamic fields i.e. field 2 shows is field 1 is not empty, field 3 shows if the value of field 2 > 20, etc.

It works pretty well once loaded or creating a new entry. The performance issue I have is when loading an existing form and running through all the show/hide logic for the first time.