If I try to validate it in http://regexstorm.net/tester online tester with my filename its working. But if I use this same syntax in my website its showing error message on button click.
Any light on this will help, maybe I am going on wrong way. :)
The upload field doesn't respect the regex validation. Feel free to submit a feature request (or bug report, depending on your perspective) here: https://github.com/rhythmagency/formulate/issues
By the way, what I usually do is add a rich text field next to the upload field that explains the files that are acceptable (e.g., "under 4MB, doc or pdf, no images").
Upload Field Validation - Formulate
I am trying to put validation on upload field using regular expression for word & pdf only, regex syntax used from https://stackoverflow.com/questions/374930/validating-file-types-by-regular-expression
^.*.(doc|docx|DOC|DOCX|pdf|PDF)$
If I try to validate it in http://regexstorm.net/tester online tester with my filename its working. But if I use this same syntax in my website its showing error message on button click.
Any light on this will help, maybe I am going on wrong way. :)
The upload field doesn't respect the regex validation. Feel free to submit a feature request (or bug report, depending on your perspective) here: https://github.com/rhythmagency/formulate/issues
I won't be working on that anytime soon, but if you have some time perhaps you can submit a pull request. You can read about contributing to Formulate here: https://github.com/rhythmagency/formulate#contributing
Alternatively, you can create a custom field type, which does not require any modifications to the core of Formulate: http://www.formulate.rocks/articles/custom-field-types
I am not entirely sure if you'll be able to get the validation working without modifying the core of Formulate, but you might be able to.
Very new to Umbraco maybe in future I will do that.
By the way, what I usually do is add a rich text field next to the upload field that explains the files that are acceptable (e.g., "under 4MB, doc or pdf, no images").
Its now just to tell them, we have to validate & of course my next point was limiting size of upload.
Can we achieve both javascript/jQuery or something else?
It seems like detecting the file size should be possible in theory with JavaScript on most modern browsers: https://stackoverflow.com/a/3717847/2052963
You'd have to integrate that with the frontend of Formulate, which is built with AngularJS.
This page (also mentioned above) has info changing the frontend of a field, such as the upload field in your case: http://www.formulate.rocks/articles/custom-field-types
is working on a reply...