Sunday, 15 August 2010

jQuery validation and accept="image/*" -



jQuery validation and accept="image/*" -

i working on form, has text fields , next input element:

<input class='ignore' name='photo' id='photo' type='file' accept="image/*"/>

also, have scripts: jquery, jqueryui, jquery validation, jquery unobtrusive , unobtrusive-ajax. think mutual set of jquery scripts.

but have met painful problem. input marked error, after select image there. true browser well.

i tried add together

$("#application-form").validate({ ignore: ".ignore" })

but didn't help. so, wondered how handle issue...

ps. tried utilize kind of workaround, adding script instead of input element:

$("#photo-container").html("<input class='ignore' name='photo' id='photo' type='file' accept='image/*'/> ");

but got same behavior

solved!

$("#photo").rules("add", { accept: "jpg|jpeg|png|ico|bmp" });

jquery jquery-validate

No comments:

Post a Comment