JQuery Append表单未在PHP中发布

时间:2018-08-13 09:41:45

标签: php jquery

我正在尝试附加包含HTML表单的表行。附加表单数据未传递到控制器。我的代码是-

case VERTICAL:
            view = inflater.inflate(R.layout.bestcollection_recycler, parent, false);
            holder = new VerticalViewHolder(view);
            break;
        case HORIZONTAL:
            view = inflater.inflate(R.layout.topselling_recycler, parent, false);
            holder = new HorizontalViewHolder(view);
            break;

        case HORIZONTAL1:
            view = inflater.inflate(R.layout.newarrival_recycler, parent, false);
            holder = new NewArrivalViewHolder(view);

            break;

        default:
            view = inflater.inflate(R.layout.bestcollection_recycler, parent, false);
            holder = new VerticalViewHolder(view);

            break;

<form method="post" action="<?=base_url()?>controller/function_name">
<table class="table table-bordered tbsize tb_wp" id="">
<thead>
  <tr >

    <th class="firstrow">Item No.</th>
    <th class="firstrow">Part No.</th>
    <th class="firstrow">Qty</th>
    <th class="firstrow">Price Quoted </th>
    <th class="firstrow"> Notes </th>
    <th class="firstrow">Internal Notes</th>  
    <th colspan="3" class="firstrow2">  
      <div class="pcrsec">
              <div class="row"><span class="pcrsecbor">Perior Customer RFQ</span></div>
                <div class="row">
                <div class="pcrsec2">
                  <ul class="list-inline">
                      <li>Date</li>
                        <li>Cust No</li>
                        <li>Price</li>
                    </ul>
                    </div>
                </div>
            </div>  
    </th>

    <th colspan="3" class="firstrow3">          
            <div class="pcrsec">
              <div class="row"><span class="pcrsecbor">Perior Customer P/O</span></div>
                <div class="row">
                <div class="pcrsec2">
                  <ul class="list-inline">
                      <li>Date</li>
                        <li>Cust No</li>
                        <li>Price</li>
                    </ul>
                    </div>
                </div>
            </div>  
   </th>
    <th colspan="3" class="firstrow4">

       <div class="pcrsec">
              <div class="row"><span class="pcrsecbor">Perior Vendor P/O</span></div>
                <div class="row">
                <div class="pcrsec2">
                  <ul class="list-inline">
                      <li>Date</li>
                        <li>Cust No</li>
                        <li>Price</li>
                    </ul>
                    </div>
                </div>
            </div>       
   </th>
  <th class="firstrow">MU%</th>
   <th></th>
  </tr>
</thead>
<tbody id="what_i_do">
  <tr>

    <td><input type="text" name="item_no[]"></td>
    <td colspan="3">
  <table>
    <tr>
      <td><input type="text" class="smlbox" name="part_no[]" onblur="checkavailpart(this)"></td>
      <td><input type="number" class="smlbox" name="qty[]"></td>
      <td>
        <input type="number" class="smlbox price_quotd_cls" name="price_quotd[]">
      </td>

    </tr>
    <tr>
      <td colspan="3"><input type="text" class="smlbox2" name="part_desc[]"></td>
    </tr>
  </table>
</td>

    <td><input type="text" name="part_note[]"></td>
    <td><input type="text" name="part_internal_note[]"></td>
    <td><input type="text" class="datepicker" name="pc_rfq_date[]"></td>
    <td><input type="text" name="pc_rfq_cus_no[]"></td>
    <td><input type="text" name="pc_rfq_price[]"></td>
    <td><input type="text" class="datepicker" name="pc_po_date[]"></td>
    <td><input type="text" name="pc_po_cus_no[]"></td>
    <td><input type="text" name="pc_po_price[]"></td>
    <td><input type="text" class="datepicker" name="pv_po_date[]"></td>
    <td><input type="text" name="pv_po_cus_no[]"></td>
    <td><input type="text" name="pv_po_price[]"></td>
    <td><input type="text" name="mu_per[]" onblur="calculate_quote_rate(this)"></td>
    <td><i class="fa fa-plus-circle fa-2x" onclick="what_i_do(this);"></i></td>
  </tr>

</tbody>

JQuery是:-

</form>

提交表单时,我仅用于获取零索引数据。我试图克隆表行,但也没有得到JQuery追加的表单的值。 请帮我解决这个问题 预先谢谢你。

2 个答案:

答案 0 :(得分:0)

在您添加的html中:

 divtest.innerHTML = '<td><input type="text" name="item_no[]"></td><td colspan="3"> <table> <tr> <td>.....

删除标签之间的所有空格

答案 1 :(得分:0)

首先请确保您的提交buttonform标记内, 那么您可以将HTML代码附加在tbody标签内:
#what_i_do 请参考tbody标签

$("#what_i_do tr").append('<tr class="removeclass'+id+'" id="removeclass'+id+'">'+ 'html code'+ '</tr>');