jQuery validate upload only, if file chosen -


i'm using jquery validate plugin validate forms. 1 form there should optional upload field. rule

  rules : {         image_file : {             accept: "image/*",     } 

it automaticly required, if upload field left empty.

rules : {     image_file : {         accept: "image/*",     }     .... 

it automaticly required, if upload field left empty.

that's absolutely impossible code you've shown us.

demo: http://jsfiddle.net/agpwk0nv/1


it's have required attribute or class on input without realizing it.

<input type="file" name="image_file" required="required" /> 

or

<input type="file" name="image_file" class="required" /> 

if want "optional", you'll need remove required.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -