EasyUI Forum

General Category => Bug Report => Topic started by: sushy on February 17, 2014, 05:22:30 AM



Title: some question about input type=file
Post by: sushy on February 17, 2014, 05:22:30 AM
hi,
when i test the code, $('#fm').form('clear') has some error when the form  has <input type=file> .

Code:

$('#dlg').dialog('open').dialog('setTitle','upload a xls file');
$("#dlg").panel("move",{top:$(document).scrollTop() + ($(window).height()-250) * 0.5});
//$('#fm').form('clear');// this code has Syntax Error when type of the input element is "file".


    <div id="dlg" class="easyui-dialog" style="width:400px;height:auto;padding:10px 20px"
            closed="true" buttons="#dlg-buttons">
        <div class="ftitle">please select xls file</div>
        <form id="fm" method="post" enctype="multipart/form-data">
            <div class="fitem">
                <label>file:</label>
                <input type="file" name="upload" id="upload"  class="easyui-validatebox" validType="fileType['xls']" required="true" />
                <input type="button" onclick="AddSubmit()" value="submit">
            </div>
        </form>
    </div>




Title: Re: some question about input type=file
Post by: stworthy on February 19, 2014, 07:53:09 AM
To solve this issue, please try to download the updated form plugin from http://www.jeasyui.com/easyui/plugins/jquery.form.js and include it to the page.


Title: Re: some question about input type=file
Post by: sushy on February 19, 2014, 09:50:04 PM
Thank you, stworthy.

It has a small flaw between $('#fm').form('clear') and $('#fm').form('validate') when the form include input type=file in jquery.form.js version 1.3.5.x .

If I add $('#fm').form('clear') when i initialize the form, Firefox console show "TypeError: _426 is undefined var opts=_426.options;", and $('#fm').form('validate') will not show the error msg  also.

It is all normal when I delete the code $('#fm').form('clear').

(http://www.readclub.net/2014/img/3.jpg)
(http://www.readclub.net/2014/img/2.jpg)


Title: Re: some question about input type=file
Post by: stworthy on February 20, 2014, 12:00:52 AM
Please refer to this example http://jsfiddle.net/UYu44/