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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -