Comments (5)
I guess the thing to decide here is: what would one expect a form like this to do? Since it's submitting to a method, autoform doesn't have any idea what you're going to do with the doc. Would we expect it to go ahead and upload all the files anyway, and call the method only after all the files are inserted and their IDs are added to doc
? Is that what you were expecting?
I think as long as we document what use cases are supported, this could be technically possible. Maybe the method could pass back false
or throw an error to tell cfs-autoform to cancel the uploads and delete the files, if the insert/update failed on the server.
from meteor-cfs-autoform.
Thanks for the reply. I have it working in my app and its been a relatively simple change that I will try to contribute back. I'll throw my changes into a branch and you can see if you want to integrate any of them.
Yes. Keep the behavior the same as it currently is. Upload the files and delete if there is a problem, just like it currently does.
As for the error cases, you can throw an Meteor.Error object in the server method and that will be presented later in the autoform "after" event. So knowing whether to rollback shouldn't be any more difficult than the client. At least, in my testing that seems to work fine. That is consistent with the client-only code as well so there are not a bunch of corner cases for testing.
BTW, I had to overcome bug #9 for this to work on my system so I already have the code to fix that for you.
from meteor-cfs-autoform.
Great @dpankros. I'm working on autoform fixes today and was hoping to fix these cfs-autoform issues after getting the next af release out, but I'm not sure whether I'll get to it today. Would like to see your PR, though if you've already solved a couple.
from meteor-cfs-autoform.
Pull request was sent for the updated code. I have not updated the readme.md to reflect the changes, however.
from meteor-cfs-autoform.
Changes were merged. Issue closed.
from meteor-cfs-autoform.
Related Issues (20)
- How do you add a before insert hook on this?
- Update for deeply nested cfs-file's broken HOT 2
- cfs-files (the multi version) does not work HOT 2
- Customize the ui "field" for multiple files
- this.template is undefined when before hook is a function HOT 1
- Exception in delivering result of invoking 'myServerMethod': Error: [[object Object]]
- file upload not working in IOS simulator
- Before hooks not work
- CfsAutoForm.Hooks.beforeInsert() is called, but after my Meteor.call() to save the form HOT 3
- Not a valid enum value HOT 1
- Error on the exemple code
- File Validation
- How to add an image preview to the update page? HOT 1
- how to display images of a array?
- Validation bug
- How to restrict file type?
- AutoForm 6.0 support. HOT 2
- How to subscribe cfs-files
- Incompatiple when adding cfs:autoform
- update form!!!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-cfs-autoform.