Bulk-entity form
Some input entities in GOERP may be submitted as a bulk (having multiple records in scope of one
form submit), allowing to create or update multiple records at once. Such inputs have array types in
data source definition - []string
(e.g. ErplyApi.ProductInSupplierPriceList
). Also, bulk
input fields may be a part of some complex input entities (e.g. ErplyApi.SalesDocumentInput
)
accepts many Row
’s as part of the input.
Warning
- Every row in the bulk should always have same order of inputs as others (check samples).
- All rows in the bulk should always have same amount of inputs. For example, goerp will fail
if one row contains
Name
andCode
and second one haveID
,Name
andCode
. IfID
undefined, then pass empty value with an input.
Bulk-entity form sample
<form method="POST">
{{/* Define entity name that should be processed */}}
<input type="hidden" name="postActionEntity" value="ProductInSupplierPriceList">
{{/* Empty row (to add new) */}}
<fieldset>
<legend>Create row:</legend>
<label for="spl-id">Supplier price list ID:</label>
<input type="text" id="spl-id"
name="ErplyApi.ProductInSupplierPriceList.SupplierPriceListID">
<label for="product-id">Product ID:</label>
<input type="text" id="product-id"
name="ErplyApi.ProductInSupplierPriceList.ProductID">
</fieldset>
<h2>Existing rows</h2>
{{/* Populate existing rows for update */}}
{{ range $i, $el := .Data.ErplyApi.ProductInSupplierPriceListList }}
<fieldset>
<legend>Row {{$i}}:</legend>
<label for="spl-id-{{$i}}">Supplier price list ID:</label>
<input type="text" id="spl-id-{{$i}}"
name="ErplyApi.ProductInSupplierPriceList.SupplierPriceListID"
value="{{$el.SupplierPriceListID}}">
<label for="product-id-{{$i}}">Product ID:</label>
<input type="text" id="product-id-{{$i}}"
name="ErplyApi.ProductInSupplierPriceList.ProductID"
value="{{$el.ProductID}}">
</fieldset>
{{ end }}
</form>