我尝试将一个表单放在foreach循环中。代码是:
@foreach( $document_rows as $row )
<?php
$idx = $row->id;
$product = Product::find( $row->product_id );
$vat = Vat::find( $row->vat_id );
$tot_riga = floatval($row->price) * intval($row->product_quantity);
?>
{!! Form::open([
'method' => 'PUT',
'route' => [ 'document.row.update', $document->id, $row->id ],
'class' => 'form-horizontal',
]) !!}
<tr class="document_row">
<td
id="field_id-{{ $idx }}"
readonly="true"
data-field="id"
data-id="{{ $idx }}"
>
{{ $idx }}
</td>
<td
class="field"
id="field_name-{{$idx}}"
data-field="name"
data-id="{{ $idx }}"
>
{{ $row->product_name }}
</td>
<td
class="field"
id="field_um-{{$idx}}"
data-field="um"
data-id="{{ $idx }}"
>
{{ $row->product_um }}
</td>
<td
class="field"
id="field_quantity-{{ $idx }}"
data-field="quantity"
data-id="{{ $idx }}"
>
{{ $row->product_quantity }}
</td>
<td
class="field"
id="field_price-{{ $idx }}"
data-field="price"
data-id="{{ $idx }}"
>
{{ $row->price }}
</td>
<td
class="field"
id="field_vat-{{ $idx }}"
data-field="vat"
data-id="{{ $idx }}"
>
{{ $vat->name }}
</td>
<td
class="field"
id="field_price_inc_vat-{{ $idx }}"
data-field="price_inc_vat"
data-id="{{ $idx }}"
>
{{ $row->price_inc_vat }}
</td>
<td
id="field_tot_riga-{{ $idx }}"
readonly="true"
data-field="tot_riga"
data-id="{{ $idx }}"
>
{{ $tot_riga }}
</td>
</tr>
{!! Form::close() !!}
@endforeach
问题是表格标签立即关闭:
<form method="POST" action="http://localhost:8888/site/public/document/1/row/update/1" accept-charset="UTF-8" class="form-horizontal"></form><input name="_method" type="hidden" value="PUT"><input name="_token" type="hidden" value="62PHHV4cnYmVOVQkkV43UCWdTkbE3tpo0OIUxuCx">
<tr class="document_row">
<td id="field_id-1" readonly="true" data-field="id" data-id="1" tabindex="1">1</td>
<td class="field" id="field_name-1" data-field="name" data-id="1" tabindex="1"></td>
<td class="field" id="field_um-1" data-field="um" data-id="1" tabindex="1">nr</td>
<td class="field" id="field_quantity-1" data-field="quantity" data-id="1" tabindex="1">100</td>
<td class="field" id="field_price-1" data-field="price" data-id="1" tabindex="1">13</td>
<td class="field" id="field_vat-1" data-field="vat" data-id="1" tabindex="1">Iva 22%</td>
<td class="field" id="field_price_inc_vat-1" data-field="price_inc_vat" data-id="1" tabindex="1">15</td>
<td id="field_tot_riga-1" readonly="true" data-field="tot_riga" data-id="1" tabindex="1">1300</td>
</tr>
有人可以帮助我吗?
答案 0 :(得分:5)
你不能把表格内表。 试试这个。
var elm = element(by.id("myid"));
browser.executeScript(function (arguments) {
arguments[0].style.visibility = 'visible';
arguments[0].style.display = 'block';
}, elm.getWebElement());
注意 :浏览器操纵html标记。