-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileField never updates #61
Comments
FileField needs an overhaul to support the way file inputs are actually used in JavaScript-heavy apps - the current version is still pretty much a direct port from Django, and is only usable with regular form submissions, with you handling everything on the server side. There's a warning to that effect in the docs, but it should be added everywhere else FileField is mentioned: Ideas for some of what needs to be done are on the Wiki:
I still haven't used file inputs in any React apps myself, nor did I get much response asking about them on the mailing list a while back, so pointers to how people are actually using them are welcome. I'll add a warning to the other areas in the docs until I get time to revisit. |
I did see that but thought I'd be able to get at the native file object some way with the current version haha. How difficult would it be to make the cleanedValue the native file object as a temporary solution? |
That might actually not be that difficult, a special case for Might just need some tweaks around some of the special cases already in place for Will have a look later today. |
…Field Only set form.files onChange if the input has a 'files' property Set an array or single file based on type of FileField Browser: retrieval of FileField data from input now falls back to data if not present in files Related to #61
I'm using a normal File field
fileupload: forms.FileField({required: false}),
and when the user selects a file and the form is submitted the form files property is an empty object. There also doesn't seem to be a way to get a react reference to the field directly to get the Form value.What I'm expecting/needing to get to:
Just like if you were to do it through straight js/jquery;
I've noticed this is the same behavior on the all fields demo
http://insin.github.io/newforms-examples/all-fields/
If you break on line 162 inside of onSubmit, after the validate
this.state.form.files
is an empty objectThe text was updated successfully, but these errors were encountered: