无法使用下拉列表检索表行中的输入值,但可以检索下拉值

Unable to retrieve input values in table row using a dropdown - but able to retrieve dropdown value

本文关键字:检索 输入 但可以 下拉列表      更新时间:2023-09-26

我认为我已经接近了,但我的(一点点)知识已经结束了。。。

执行此函数时,LLORDa和LLINEa不会从表行中检索值(因此不会将所有值插入到表中)。谢天谢地,我的SVCDESC从下拉列表中得到了所选的值。有什么想法吗?提前感谢各位!

    <script>
        jQuery(function() {
            jQuery("input:submit, input[type=button], input[type=submit], button, .button").button();
        });
function saveSMR()
        {
            var SVCDescDropDown = $(this); 
            var row = SVCDescDropDown.closest("tr.row"); 
            var LORDaInput = row.find("input[name=LORDa]");
            var LLINEaInput = row.find("input[name=LLINEa]");  
            jQuery.ajax(
            {
                url: 'B2BORD493.PGM', 
                type: 'POST',
                data: {task: 'savServMiss', LORDa: LORDaInput.val(), LLINEa: LLINEaInput.val(), SVCDESC: SVCDescDropDown.val()},                
            }).done(function(message)
            {
                alert(row.length);
                jQuery('#dialog').dialog('close');      
            }); 
            console.log(LORDaInput.val() + LLINEaInput.val());      
        }
        $(document).ready(function() {
            $(function() {
                $("select[name=SVCDESC]").on("change", saveSMR);
                $("#dialog").dialog({
                    autoOpen: false
});
$("#pbutton").on("click", function() {
$("#dialog").dialog("open");
});
});
 });
    </script>

<tr class="row"> 
<td class="text num">1043121</td>
 <td class="text num">22</td>
  <select name="SVCDESC">
 <option value=""></option>
 <option value='STK'>No Stock</option>
    <option value='TES'Test Desc</option>
    </select>
  </td>
  <input type="hidden" name="LLINEa" />
  <input type="hidden" name="LORDa" />
</tr>
编辑:对不起,我误解了你的问题。没有为您正在调用的隐藏字段分配任何值。也许这就是为什么没有价值观?
<input type="hidden" name="LLINEa" />
<input type="hidden" name="LORDa" />

也许像这样的东西会返回一些值?

<input type="hidden" name="LLINEa" value="123" />
<input type="hidden" name="LORDa" value="abc" />