The conflict between the load function of jQuery form and the assignment of El expression

Source: Internet
Author: User

Problem:

When an El expression is used to assign an initial value to an item in a form, it always fails, and the logistics company is not automatically selected, and the logistic number is not displayed.

<form id= "form" method= "POST" >
。。。。
<TR> <th>Logistics company:</th> <TD> <SelectID= "Shippingcompany"name= "Shippingcompany"class= "Easyui-combobox"style= "width:171px;"data-options= "Required:true"> <C:choose> <C:whenTest= ' ${notempty Brand} '> <C:foreachvar= "LC"Items= "${logisticscorporations}"> <C:choose> <C:whenTest= ' ${brand.shippingcompanyeq lc.logisticsid} '> <optionvalue= "${lc.logisticsid}"selected= "Selected">${lc.logisticsname}</option> </C:when> <c:otherwise> <optionvalue= "${lc.logisticsid}" >${lc.logisticsname}</option> </c:otherwise> </C:choose> </C:foreach> </C:when> <c:otherwise> <C:foreachvar= "LC"Items= "${logisticscorporations}"> <optionvalue= "${lc.logisticsid}" >${lc.logisticsname}</option> </C:foreach> </c:otherwise> </C:choose> </Select> </TD></TR><TR> <th>Logistics Tracking Number:</th> <TD><inputname= "SHIPPINGSN"ID= "SHIPPINGSN"class= "Easyui-textbox easyui-validatebox"type= "text"value= "${BRAND.SHIPPINGSN}"Required= "Required"/></TD></TR>
</form>

Investigation:

1, when I put class= "Easyui-combobox" and class= "Easyui-textbox Easyui-validatebox" attribute removed, it is normal. Suspicion is the Easyui conflict.

2, when I delete the form tag, or change the id attribute of the form to a name, also normal, suspect is jquery in the use of the form when the conflict caused.

3, continue to investigate, the current page is actually an editing page, it is opened in the parent page:

//Shipping function ship () {var row = $dg. DataGrid (' getselected ');            if (row) {Parent.$.modaldialog ({title: ' Edit order Information ', width:600, height:270, HREF: "${pagecontext.request.contextpath}/orders/showship?orderid=" +row.orderid+ "&orderinfoid= "+row.orderinfoid, Onload:function () {var f = Parent.$.modaldialo                G.handler.find ("#formx");            F.form ("Load", row); }, buttons: [{text: ' OK ', iconcls: ' Icon-ok ', handler:funct Ion () {parent.$.modaldialog.openner= $grid;//Because the DataGrid needs to be refreshed after it has been added, the first predefined var f                    = Parent.$.modaldialog.handler.find ("#form");                F.submit (); }}, {text: ' Cancel ', Iconcls: ' Icon-cancel ', handler:function ()                    {Parent.$.modaldialog.handler.dialog (' destroy ');                Parent.$.modaldialog.handler = undefined;    }            }            ]        });        }else{Parent.$.messager.show ({title: "Hint", msg: "Please select a row of records!", timeout:1000 * 2    }); }}

DG is a DataGrid table, and our edit page is the one row of data that the DG selects. Note that the OnLoad method, after the data has been loaded, has a f.form ("load", row) method that automatically populates the individual property values of this row of data into the corresponding table items in the editing page.

This essentially conflicts with the use of an El expression in an edit page to assign a value to a table item, that is, you either use F.form ("load", row) to assign a value to the table item, or you can use an EL expression to assign a value to the table item, only one option.

Solve:

Remove the OnLoad method.

The conflict between the load function of jQuery form and the assignment of El expression

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.