从包含<ul>列表</ul>的已发布表单中获取值

时间:2011-10-17 12:49:16

标签: jquery forms post

我有一个简单的表格:

<form id="myForm" method="post"
    action="../SentinelOperationsUI/SystemAuditView.aspx" class="formular">

<fieldset>
    <legend>
        Buy-In
    </legend>
    <label>
        <select id="buyIn" name="buyIn" class="validate[required]">
            <option value=""></option>
            <option>New System Subscription - Third Party System Evolution - Five Year Buy-In</option>
            <option>New System Subscription - ABB System Evolution - Three Year Buy-In</option>
            <option>New System Subscription - Three Year Buy-In</option>
            <option value="SID-repeated">Plant Site Subscription - Buy-In plus Synchronization</option>
        </select>
    </label>
</fieldset>

<fieldset class="SIDContainer" style="display: none;">
    <legend>
        SID (repeated)
    </legend>
    <label>
        <input type="text" class="SID" style="text-transform: uppercase;"/>
        <input type="button" value="Add" class="addSIDToList" style="display: none;" />
    </label>

    <ul class="SIDList" name="SIDList" 
        style="text-transform: uppercase; list-style: disc; "></ul>

</fieldset>

<input class="submit" type="submit" value="Submit"/>
</form>

通过jquery填充ul-list。是否有任何聪明的方法来阅读我发布到的页面上的发布值?或者我需要使用$ .post手动发布它们吗?感谢

1 个答案:

答案 0 :(得分:1)

如果用li填充ul,每个包含一个包含实际值(无论是否隐藏)的输入元素,您只需发布页面,您的值就应该发送到服务器。当然,您可以使用脚本执行此操作,只需将值添加到某个对象(或从DOM树中手动读取它们),然后通过某些AJAX方法(如$ .post)将该对象传递给服务器。

相关问题