EasyUI Forum
September 14, 2025, 12:25:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: some question about input type=file  (Read 14815 times)
sushy
Newbie
*
Posts: 4


View Profile
« 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>


« Last Edit: February 19, 2014, 02:38:21 AM by sushy » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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.
Logged
sushy
Newbie
*
Posts: 4


View Profile
« Reply #2 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').


Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: February 20, 2014, 12:00:52 AM »

Please refer to this example http://jsfiddle.net/UYu44/
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!