Title: [SOLVED] validate filebox Post by: catpaw on October 26, 2016, 04:17:17 PM hello,
Please help, I need validate the file size of a filebox Code: <input id="anexo" class="easyui-filebox" name="anexo" style="width:100%;height:32px;" data-options=" This not work, because the input is not type file Code: alert($('#anexo').files[0].size); how can I get the filebox size? thanks Title: Re: validate filebox Post by: catpaw on October 26, 2016, 04:32:47 PM hi
Its done ;) Code: var f = $('#anexo').next().find('.textbox-value'); thanks Title: Re: validate filebox Post by: catpaw on October 26, 2016, 04:44:47 PM Please now I want to extend the validate with the size maximun
Code: $.extend($.fn.validatebox.defaults.rules, { Code: <input id="anexo" class="easyui-filebox" name="anexo" style="width:100%;height:32px;" data-options=" but I get this error: Quote Uncaught TypeError: Cannot read property 'files' of undefined What Im doing wrong? Title: Re: validate filebox Post by: catpaw on October 26, 2016, 04:51:49 PM I change this:
var file = $(this).next().find('.textbox-value'); for this: var file = $('#anexo').next().find('.textbox-value'); Code: $.extend($.fn.validatebox.defaults.rules, { and its ok, it works but how can I do it dynamic?? second: I add a file of 425 KB and I get the maximun size error message if(sizeKB > 999){ alert(sizeKB); return false; } but 425 not is greater than 999 !!! Title: Re: validate filebox Post by: stworthy on October 26, 2016, 08:43:00 PM Please try this code:
Code: <script type="text/javascript"> Title: Re: validate filebox Post by: catpaw on October 27, 2016, 09:05:33 AM Perfect!!
thanks a lot |