简体   繁体   中英

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

I think I am close, but my (little) knowledge has come to an end...

When executing this function, my LLORDa and LLINEa are not retrieving the values from the table row (thus not inserting all values into my table). My SVCDESC from the drop down IS getting the selected value thankfully. Any ideas? Thanks in advance guys!

    <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>

EDITED: Sorry I misread your question. There are no values assigned to the hidden field that you are calling. Maybe that is why there are no values?

<input type="hidden" name="LLINEa" />
<input type="hidden" name="LORDa" />

Perhaps something like these will return some values?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM