-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Invalid file types are correctly not added to the model but turn the form invalid #1593
Comments
Same problem here. Need a way to stop invalid files being added to the model, and also keep the form valid. |
So is there a fix for this? I am encountering the same issue as OP. |
Hi there, then, on the controller:
Hope this helps you |
You can use |
Thanks @danialfarid. |
That is the name of the error which is specified on each validation directive. |
You can test it on the demo page by removing accept and setting ngf-ignore-invalid to pattern |
I was still having trouble with ngf-ignore-invalid. invalid files weren't being added but the form was still being set as invalid. I checked the source and found a logic typo. #1685 should fix it now, if there were a way to ignore invalid files (not validate them) but still give a message? I've tried other fixes in the forums but my form has other fields in it that I want to check. |
@jonathan-chin ignore-invalid is there to ignore the validation so you it won't be validating those. If you want it to be validated you can just let it be validated and in the |
@danialfarid How can I use I tried this, but it's not working... |
That should work, What's the value of the |
When I print the error value for the content in This is the full form error (
|
Can you create a jsfiddle or test it on the demo page? |
@danialfarid Here you go - the button still becomes invalid if an image is used outside the specified dimensions. |
This is working as expected for me: http://jsfiddle.net/z08x4ubk/ |
@danialfarid I'm still seeing the same problem. In your example, when I select an image with invalid dimensions - the form button still turns invalid - it is not ignoring validateAsyncFn. |
@stevehealy fixed at 12.2.9 |
Verified. Many thanks. |
@danialfarid How can I show my images thumbnail. for example I have this https://es.stackoverflow.com/questions/90609/error-al-mostrar-preview-de-imagen-en-angularjs ` |
So I have this snippet which actually works fine adding multiple files on multiple drags/selects, until I add an invalid file type. The invalid file type is not added to the model but will make the form invalid. The form becomes valid again when I add/append another valid file to the list. I tried put allowInvalid false, ngf-valid-only but none of them solve my problem. Always get the form.files.$error = {"pattern":true} when adding an invalid file.
How can I make these unsupported file types not turn the form invalid?
The text was updated successfully, but these errors were encountered: