EasyUI Forum
May 30, 2024, 04:38:01 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: using window, data submit error  (Read 11166 times)
kissmoon
Newbie
*
Posts: 25


View Profile
« on: December 04, 2014, 06:27:44 PM »

when I us easy ui window to add new data.The code is bellow:

$('#win').window('refresh', '/GetUnit/AddUnitChild?id_unit=' + id_unit).window('setTitle', 'new unit').window('open');

when open page,and new first data,is normal. but add two or more , the page will submit two or more.

run one time code,add one data, run two time code,add two data,and so...


Logged
kissmoon
Newbie
*
Posts: 25


View Profile
« Reply #1 on: December 04, 2014, 06:58:07 PM »

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


View Profile Email
« Reply #2 on: December 04, 2014, 07:16:51 PM »

What is '/GetUnit/AddUnitChild?id_unit=' + id_unit? How do you define your form and window? Please provide an example(html page) or a link page to demonstrate your issue.
Logged
kissmoon
Newbie
*
Posts: 25


View Profile
« Reply #3 on: December 04, 2014, 08:25:04 PM »

'/GetUnit/AddUnitChild?id_unit=' + id_unit?    is controller/action?parameter。
/GetUnit/AddUnit
      [get]
       public ActionResult AddUnit(int id_unit)
        {
            bas_unit_tb selected_unit = db.bas_unit_tb.Find(id_unit);
            bas_unit_tb init_unit = new bas_unit_tb();
            init_unit.id_unit_parent = selected_unit.id_unit_parent;
            init_unit.system_identify = selected_unit.system_identify;
            init_unit.is_first = 0;

            return View(init_unit);
        }


the action have the view is
@using (Ajax.BeginForm("AddUnit", new AjaxOptions()))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        。。。。
}


main page have a button , onClick = "AddUnit()",bellow is addunit() code.
function AddUnit() {
    var node = $('#treeunit').tree('getSelected');
    var id_unit = node.id;
    $('#win').window('refresh', '/GetUnit/AddUnit?id_unit=' + id_unit).window('setTitle', 'new unit').window('open');
}

Logged
kissmoon
Newbie
*
Posts: 25


View Profile
« Reply #4 on: December 04, 2014, 08:30:27 PM »

main page window


    <div id="win" class="easyui-window" title="new unit" style="width:600px;height:400px"
        data-options="iconCls:'icon-save',modal:true,minimizable:false,maximizable:false,collapsible:false,closed:true">
    </div>



<input type="button" onclick="AddUnit()" value="New" />
Logged
kissmoon
Newbie
*
Posts: 25


View Profile
« Reply #5 on: December 04, 2014, 08:32:38 PM »

the tool is ms vs , project use mvc4
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #6 on: December 05, 2014, 01:28:56 AM »

It is hard to run your code since anyone can not understand your database code and your background environment. Please provide the example with pure html code.
Logged
kissmoon
Newbie
*
Posts: 25


View Profile
« Reply #7 on: December 07, 2014, 07:48:52 PM »

It is hard to provide the example with pure html code.
It is mvc4.
I try other way.
Thanks.
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!