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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -