fromField (naam_invoerveld)
Entity | Value |
---|---|
Attribute(s) | style, href, title, alt, value, name, onclick |
Type | function, value |
Context | myshop-block:productlist, myshop-repeat-products:< conditie > |
Parameters | 1: name inputfield |
Result | value of the inputfield |
With the function fromField a value from a field within the document can be accessed. This function can be applied to read the number of products that need to be placed in the shopping basket (see the example below).
This example shows how to use the value of the field ‘quantity’ as the number of products when the order button is clicked. If the function is used within a myshop-block:product a collection of ‘quantity’ fields is automatically presumed. It is not necessary to ensure that each product has a unique name for the field ‘quantity’.
<table style="myshop-block:productlist" border="1">
<thead>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td style="myshop-label:1;font-weight:bold"></td>
<td style="myshop-label:2;font-weight:bold"></td>
</tr>
</thead>
<tr style="myshop-block:product">
<td><input name="quantity" size="2" value="1"/></td>
<td><a style="myshop-action:orderdirect, quantity={$fromField(quantity)}">order</a></td>
<td><a style="myshop-action:moreinfo">more info</a></td>
<td style="myshop-value:1;color:red"></td>
<td style="myshop-value:2"></td>
</tr>
</table>
Post your comment on this topic.