-
Notifications
You must be signed in to change notification settings - Fork 306
Forms, inputs and validation #29
Comments
@tmeasday the action items from this should be added as separate issues if we are sure they should actually be done. |
👍 I've been having second thoughts about deprecating check as being the right call for this iteration of the guides however. What do you think? |
My only reservation is that then you won't be able to easily check stuff like the length of a string in a method argument, right? |
In a world where the method "checks" form the validate part of the method? I guess I'm more thinking of trying to re-implement |
Proposed outline
|
@stubailo not sure about
|
|
Wow, I appreciate the love @stubailo. :) Regarding check/ss, this has been supported for a long time: check(obj, new SimpleSchema({ ... })) (And gives more helpful errors than basic check patterns.) But if check method were built into SS, I guess it could be shortened to AutoForm thoughts/roadmap:
After all that, I'm going to investigate either a release or a port to support React. |
What does this mean for the huge library of autoform plugins?
Could this be accomplished as kind of a refactor to move the core logic into a place independent of the view layer somehow? I don't know exactly what that would mean, but it probably boils down to a consistent JS API for the different form components. |
I've attempted several times to figure out a way to separate form rendering, validation, and submission concerns into their own packages, but it's pretty impossible right now. That said, every change I make is with an eye toward that eventual goal. I don't think there will be huge impacts on the add-on pkgs when releasing 6.0, but any that provide custom input types with tricky values will need to implement the new API for change tracking, basically emitting some custom event when the input value should be considered changed. And they will all have to update their dependencies to |
@aldeed I think the love is totally warranted. I should publish and point you at the react form component lib we built for Galaxy. I'll do that sometime soon. It's in no way as full-featured as autoform[1] but I suspect it has a lot of the same ideas, perhaps leaning more in the direction that we'd love to see autoform go in (and you are probably leaning also by the sounds of it). [1] I actually don't think it's "correct" in the way it passes data between the form and the inputs, but that's a hugely technical discussion that is out-of-band here. |
Outline merged https://github.com/meteor/guide/blob/master/outlines/forms.md! |
I've written a tutorial on Constraint Validation in a Plain JS App, and I'd like to propose taking a similar approach in the Meteor Guide. The most important points are:
Although I don't know much about Meteor (yet), I'd like to contribute material from my tutorial and co-author a corresponding Meteor validation tutorial. |
@tmeasday thanks for pointing me here in reference to files. Is CollectionFS still considered the best solution? My concerns with the package are the number of outstanding issues it has and that it doesn't seem to be maintained. |
@merlinpatt, honestly, I'm not sure. We wrote this outline a few months ago before the maintainer of CollectionFS decided to move on. What are other people doing? |
Looking up "file" or "upload" on Atmosphere returned the below, which I picked because they had the most downloads. I also just put a poll up on the forums about what people are using. I suspect most will say they're still using CollectionFS. |
I did just realize that with 1.3 having better support for NPM, it might be better to suggest a file upload solution from the NPM community. |
Are there full-stack npm file upload packages? FWIW, I chose https://github.com/CulturalMe/meteor-slingshot and works well for me |
Hi! Was article outline removed / relocated? The link goes to 404 now. |
Here's what it had: https://github.com/meteor/guide/blob/06094c8374a4f5b9035c23be5abdbf15b26e65e0/outlines/forms.md Not too much stuff unfortunately. |
@stubailo I'd like to contribute if there are some guidelines on proper contribution ) |
that would be amazing! first step is writing up an outline, perhaps based on that one, and submitting a PR for it. |
Yeah @romaroma that would be great! We have https://github.com/meteor/guide/blob/master/CONTRIBUTING.md |
I'm closing this issue because it's too old. We are going to make many updates to the guide in the next weeks and it's better to focus on issues with recent activity. If you think this issue is still relevant please open a new one. |
Article outline
https://github.com/meteor/guide/blob/master/outlines/forms.md
Major decision points
autoform
is the best Meteor form solution available today, we're going to make sure it integrates seamlessly with the method solution aboveCollectionFS
is the best file upload solutionOld info:
Related PR: #27
Today I got the chance to spend some time talking to @tmeasday, who's visiting from Australia! He's bringing his years of experience writing production apps as part of Percolate Studio and MDG, and his learnings from co-writing Discover Meteor, to the Meteor Guide project. Awesome!
Let's get into what we talked about regarding forms, methods, and user input in general.
Features of a good form solution
The biggest requirement we identified here is a need for a standardized pattern for different kinds of input errors you might want to display to the user. Then we also came up with some ideas about the code that could be involved:
This suggests some idea of a "validated method" - a method that isn't just a single function, but perhaps several that can be run separately. Similar to @SachaG's two-tiered methods, except all of the tiers are conceptually part of the method, and there might be more than two of them.
Here's a diagram that represents the picture I have in my mind. Obviously it's not finished, but it outlines the shape of things that I see:
Action items
check
) or have a super custom form integration (likesimple-schema
).check
package by bringing the best parts of that into simple-schema; in particular that means having a way to just do a one-shot check of an object against a schema without needing to first initialize a validation context. This way it will be much more natural to reuse the schema in the form and the server-side validation.Notes
The text was updated successfully, but these errors were encountered: