EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: adg456jljlx on March 12, 2018, 07:36:43 PM



Title: the validate method about form
Post by: adg456jljlx on March 12, 2018, 07:36:43 PM
When I use the validate method in a pop-up form window, it works.

$('#sub_form').form('validate')

<div id="sub_window" class="easyui-window" title="Add Info"
     style="width: 400px; height: auto;">
    <form id="sub_form" method="post">
    </form>
</div>

 But when I used the validate method in a multi-level pop-up window, it was wrong.

(http://qigemingzizhennan.oss-cn-shanghai.aliyuncs.com/1520907005564.jpg?Expires=1520994036&OSSAccessKeyId=TMP.AQGxjJwPtkbZcsZCiQv8wcMhBGC5zrUy5_LfzjyQ0N4Rd_goyXiqkdRvDxm8ADAtAhUAtZ_zFAXk7jdsKuYmUW5MCW-OyogCFC7Mf6WvdZ8YQEt_6bSZMRqwocSF&Signature=X6fSRyHvgbWEv6E%2Bp0o09NIpeUU%3D)

(http://qigemingzizhennan.oss-cn-shanghai.aliyuncs.com/1520908291405.jpg?Expires=1520973112&OSSAccessKeyId=TMP.AQGxjJwPtkbZcsZCiQv8wcMhBGC5zrUy5_LfzjyQ0N4Rd_goyXiqkdRvDxm8ADAtAhUAtZ_zFAXk7jdsKuYmUW5MCW-OyogCFC7Mf6WvdZ8YQEt_6bSZMRqwocSF&Signature=IaqWbw4eU7SvkA4ocxrUOnut16g%3D)

Sub_window was the first pop-up window, and tree_add_window was the second popup window.The form is in the second pop-up window.

the version of easyui is 1.5.1.

For help.


Title: Re: the validate method about form
Post by: jarry on March 12, 2018, 11:41:09 PM
How do you declare the 'tree_add_window' and the form. Please show an example or some code snippets to demonstrate your issue.


Title: Re: the validate method about form
Post by: adg456jljlx on March 13, 2018, 01:16:33 AM
How do you declare the 'tree_add_window' and the form. Please show an example or some code snippets to demonstrate your issue.

some code is below. The attachment contains the complete page code.

Thank you very much!

            //字典类型为字典数据,树形或列表数据窗口
            var sub_win = $('#sub_window').window({
                modal: true,
                closed: true,
                minimizable: false,
                maximizable: false,
                onClose: function () {

                }
            });

            //树形数据新增或编辑窗口
            var tree_add_window = $('#tree_add_window').window({
                modal: true,
                closed: true,
                minimizable: false,
                maximizable: false,
                onClose: function () {
                    $('#tree_add_form').form('clear');
                }
            });

<div id="tree_add_window" class="easyui-window" title="Add Info"
     style="width: 400px; height: auto;">
    <form id="tree_add_form" method="post">
        <table width="100%" cellpadding="0" cellspacing="1">
            <tr height="40">
                <td width="100" align="right">
                    <span id="nodeName"></span>:
                    <input type="hidden" name="nodeId"/>
                    <input type="hidden" name="nodePid"/>
                </td>
                <td colspan="3">
                    <input class="easyui-validatebox" type="text" name="nodeName"
                           data-options="required:true,validType:['length[0,50]']" size="30"/>
                </td>
            </tr>
            <tr height="40">
                <td width="100" align="right">
                    <span id="nodeValue"></span>:
                </td>
                <td colspan="3">
                    <input class="easyui-validatebox" type="text" name="nodeValue"
                           data-options="required:true" size="30"/>
                </td>
            </tr>
            <tr height="40" align="left">
                <td>
                    &nbsp;
                </td>
                <td colspan="3">
                    <a id="tree_submit_btn" href="javascript:void(0)"/>
                </td>
            </tr>
        </table>
    </form>
</div>



Title: Re: the validate method about form
Post by: jarry on March 13, 2018, 02:31:03 AM
You used a wrong 'name' attribute value(nodeName). Please change to another value.
Code:
<input class="easyui-validatebox" type="text" name="nodeName1"
       data-options="required:true,validType:['length[0,50]']" size="30"/>


Title: Re: the validate method about form
Post by: adg456jljlx on March 13, 2018, 07:36:09 PM
You used a wrong 'name' attribute value(nodeName). Please change to another value.
Code:
<input class="easyui-validatebox" type="text" name="nodeName1"
       data-options="required:true,validType:['length[0,50]']" size="30"/>

Thank you very much. It is true that this is the cause of this problem.   :D