Blaze SimpleSchema Forms Tutorial

#1

Hi,

I’ve been using Meteor for about 8 months now and have relied heavily on the autoform package when creating forms which has been fantastic however I’d like to take the next step and learn to manually create complex forms.

I’ve read that using simpleschema then manually building forms is a great way to go.

I understand the basics, however, I was hoping someone could point me in the right direct for a tutorial on the way to build insert/update forms that are complex and runs through select, checkboxes, etc.

Any suggestions would be greatly appreciated.

1 Like
#2

Great question. I’d like to do this as well, but I’ll just add, manual (“inside template”) reactive client side form validation. This is the one feature that keeps me with Autoform.

1 Like
#3

Good point. That would great. A tutorial on this would be amazing.

#4

Yeah, I’ve been looking for a solution and asking around about this for a long time now, I think with MDG’s shift to React and Apollo, that ship has sailed unfortunately. I’m having a hard time finding new tutorials and howto’s on Blaze these days.

1 Like
#5

To be clear, what you are looking for is a tutorial on how to manually validate and display errors on a standard html form in blaze?

#6

I’m not sure what you mean by “standard forms”. I know how to do simple input textbox forms. What would be good is tutorial that creates an input/update form with things like, select-checkbox, select-options, etc. Plus validation with display errors when using simpleschema.

#7

Oh, so an advanced autoform tutorial using simple-schema for form definition and validation?

1 Like
#8

Yes. That sounds right.

#9

I’ve actually been thinking about doing a quick video on simple-react-form. I could see about putting something together for auto form as well. Can you give an example of the complexity you are looking for?

#10

That would be cool.

For instance, a form that had questions that have select-dropdown menus, multiple select-checkboxes, booleans, etc. It would also be good if you could show how one form can save answers to multiple collections. Another good thing might be, follow-on questions that change based on a person previous answer.

Some transition css effects to show one question at a time might be cool to.

Ie. select-dropdown
What brand soap do you use?

  • No brand
  • Omo
  • Finish

Select-checkboxes (array)
What car do you own?

  • Ford
    -Camry

Follow on the question.

Do you drink wine or beer?
Beer - Next question lists beer brands
Wine - Next question lists wine brands

Just to be clear because you mentioned autoform, what we are looking for is a tut on how you can use simpleschema and create custom forms without using autoform.

Any help would be appreciated, so if you do make a tut, please let me know. It would great to learn.

#11

So no autoform would be manually wiring up validation and error messages to the form in blaze. Seems like masochism to me :laughing:

1 Like
#12

Fair enough. I thought validation was done by simpleschema?

#13

Yes, validation is, but you would have to manually gather all the form data, compile it into the proper shape, feed it into simple-schema’s validation, and wire up the display of all the errors. AutoForm still allows you to create really complex forms through the use of afForm and afField without having to manually handle any of the other stuff.

#14

Ah, I didn’t realise that. Maybe a good tutorial using autoform isn’t a bad idea.

#15

I guess with autoform it is really worth checking out this folder right here, which will teach you how to create your own autoform-input-types, which is what we need more of in order to keep autoform alive:

Check out this link

#16

Exactly – and to have that all reactive is difficult. I’d rather not use autoform anymore, but without a solution to this, I’m stuck.

#17

Depreciated?

#18

Right so what does this look like? And how would the loop back around to the temple be made?