ko.mapping.toJS不检索多个select的字段值

时间:2014-10-24 16:19:08

标签: knockout.js jquery-select2

我使用Knockout和Select2。

这是Select2容器:

<div class="select2-container select2-container-multi" id="s2id_edit_field_opportunity_list" style="width: 226px;">
    <ul class="select2-choices">
        <li class="select2-search-choice">
            <div>Post Tier II</div>
            <a href="#" onclick="return false;" class="select2-search-choice-close" tabindex="-1"></a>
        </li>
        <li class="select2-search-field">
            <input type="text" autocomplete="off" autocorrect="off" autocapitilize="off" spellcheck="false" class="select2-input" id="s2id_autogen38" style="width: 10px;">
        </li>
    </ul>
</div>*

隐藏的领域:

<input type="hidden" data-bind="attr: {disabled: $root.freezeForm, id: field_id}, value: $root[field_name], select2: {data: {results: options}, multiple: true }" id="edit_field_opportunity_list" tabindex="-1" class="select2-offscreen" value="Post Tier II">

这是提交代码:

saveItem: function()
            {
                var self = this,
                saveData = ko.mapping.toJS(self);
                saveData._token = csrf;
                console.dir(saveData)
                ...

记录字段opportunity_list的空值:

Object_token: "GgWevTcnil1lc93FUaQE2Rmla57JDQonAQArF4Bg"
bc_sales_person: "Eric"
budget: "94400.00"
client_billing_contact: "fdf"
client_billing_email: "joa@a.com"
client_name: "Benjamin Roberts"
coin: "GBP"
flight_from: "2014-10-14"
flight_to: "2014-10-31"
id: "7"
opportunity_list: ""
payment_term: "Net 60"
tracking_platform: "IdevAffiliate"

为什么没有映射该值的任何想法?

0 个答案:

没有答案