grevory / bootstrap-file-input

Standardizes the file input field to look like a Bootstrap button in all browsers
Other
179 stars 63 forks source link

Validate file extension #29

Open jorgecas99 opened 10 years ago

jorgecas99 commented 10 years ago

Can you add support for a new attribute called 'validate' or something like that where you can pass a value or values separated with commas. This way if the file doesn't have that extension it will print a error below the button?

I use your plugin all the time, thank you, unfortunately Ruby when you create the field the validation is not working right, it passes the error message to the label right after the button which looks like the button grew in height. screen shot 2014-05-09 at 11 04 33 am

grevory commented 10 years ago

What would the value be exactly?

jorgecas99 commented 10 years ago

screen shot 2014-05-09 at 2 45 20 pm The value for what? the attribute? I was thinking that would be whatever the user wants to pass in, I was thinking something along these lines: <input type="file" title="Upload File" class="btn-link" 'validate="jpg, png, gif" />

Notice that class is not mention in the doc but you do support it, which is cool, I found it by reading the code.

It would be nice is the validate attr throws a error to a label after the button, not the one inside of it. Like this.