首页 > 解决方案 > 如何在 laravel 中验证动态行输入

问题描述

我正在为药房公司开发一个应用程序,产品有很多批次。创建新发票时。他们不会在发票项目列表中输入具有相同批号的相同产品。如何使用 laravel 规则进行验证。

在此处输入图像描述

我的刀片(动态行):

 <tr class="item_row" id="item-row-0">
     <td>
     <select class="form-control boxed" name="items[0][product_id]" id="product_id0" onchange="productattribute(0)" data-width="100%" required>
     <option value="">Select</option>      
    </select>
    </td>
  <td>
<select class="form-control boxed widthonefifty" name="items[0][batch_no]" id="batch_no0" onchange="setmaximumQuantity(0)" required>
<option value="">Select</option></select></td>
    <td>
   <input type="text" class="form-control boxed traitmbox" name="items[0][quantity]" id="quantity0" data-trigger="calculation" data-calculation="quantity" data-parsley-type="digits" data-parsley-trigger="keyup blur" max="0" required>
      </td>
      <td>
     <input type="text" class="form-control boxed alnrit" name="items[0][product_amt]" id="product_amt0" data-calculation="productamt" tabindex="-1" readonly required>
   <input type="hidden" class="form-control boxed" name="items[0][total_product_amt]" id="total_product_amt0" data-calculation="totalproductamt" readonly>
    </td>
   <td>
     <input type="text" class="form-control boxed traitmbox" name="items[0][discount_rate]" id="discount_rate0" data-calculation="discount_rate" tabindex="-1" readonly>
 <input type="hidden" class="form-control boxed" name="items[0][discount_amt]" id="discount_amt0" data-calculation="discount_amt" readonly>
   <input type="hidden" class="form-control boxed" name="items[0][taxable_product_amt]" id="taxable_product_amt0" data-calculation="taxable_product_amt" readonly>
     </td>
     <td>
    <input type="text" class="form-control boxed traitmbox alnrit" name="items[0][tax_rate]" id="tax_rate0" data-calculation="tax_rate" tabindex="-1" readonly>
    <input type="hidden" class="form-control boxed" name="items[0][tax_amount]" id="tax_amount0" data-calculation="tax_amount" readonly>
   </td>
    <td>
    <input type="text" class="form-control boxed alnrit" name="items[0][row_total]" id="row_total0" data-calculation="row_total" tabindex="-1" readonly required>
    </td>
     <td>
      <a href="javascript:void(0);" onclick="removeRow(0);" tabindex="-1" style="float:left;"> <i  class="fa fa-trash btn btn-danger"></i></a>
     </td>
    </tr>

标签: phplaraveleloquentlaravel-request

解决方案


推荐阅读