0

我有以下文本框位于表单中:

<input type="text" id="duration" name="duration" readonly="readonly"  style="width:0px"/>
<input type="text" id="renew" name="renew" readonly="readonly" style="width:0px"/>
<input type="text" id="accountAfter" name="accountAfter" readonly="readonly" style="width:0px"/>

在表单发布时,这些文本框会将数据传递给从以下对话框中检索到的控制器:

 $('#fixed').dialog({
        autoOpen: false,
        width:600,
        resizable: false,
        title: 'Fixed Account Details',
        modal: true,
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            },
            "OK": function () {
                $('#duration').val($('#duration').val());
                $('#renew').val($('#renew').is(':checked'));
                $('#accountAfter').val($('#accountAfter').val());
                $(this).dialog("close");
            }
        }
    });

是否可以在传递数据的同时向用户隐藏这些文本框?

4

1 回答 1

1

将它们更改为隐藏的输入元素。例如:

<input type="hidden" id="duration" name="duration" />

我认为您的其余代码可以保持不变,尽管我不确定您要在这里完成什么;您只是将值更新为自己。

$('#duration').val($('#duration').val());
$('#renew').val($('#renew').is(':checked'));
$('#accountAfter').val($('#accountAfter').val());
于 2013-05-15T22:23:54.353 回答