Fixed data load error when Filebox is present in Bug--form of Easyui

Source: Internet
Author: User

Using Easyui to load the data returned by the server is often used for $ (' #fm '). Form (' Load ', row); Implementation, both convenient and concise, however, when the form contains Filebox, the code will be error, after tracking discovery, because Easyui tried to hide the file tag <input type= "Files" > assigned value, resulting in an error. Its source code is as follows:

Initvalue:function (JQ, _4d9) {return Jq.each (function () {var _4da = $.data (This, "TextBox"); _4da.options.value = ""; $ (th IS). TextBox ("SetText", _4d9), _4da.textbox.find (". Textbox-value"). Val (_4D9); $ (this). Val (_4d9);});},
Error by _4da.textbox.find (". Textbox-value"). Val (_4d9); As a result of this, therefore know prajna needs to rewrite it so that it can skip the assignment as it processes the file label. The modified code is as follows:

Initvalue:function (JQ, _4d9) {    return Jq.each (function () {        var _4da = $.data (This, "TextBox");        _4da.options.value = "";        $ (this). TextBox ("SetText", _4d9);        var obj = _4da.textbox.find (". Textbox-value");        if (obj.attr ("type")! = "File") {            obj.val (_4D9);        }        $ (this). Val (_4d9);    });
Of course, if you just show the data after the load, then there is no problem, if you can submit again, do update operation, then you have to be careful, because at this time, although the page shows the file server path, but, The file tag that is actually submitted to the server does not actually point to any local files, so the file submitted is empty.



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Fixed data load error when Filebox is present in Bug--form of Easyui

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.