Reputation: 3
I am working on a Ecommerce application and want to dynamically set the maximum amount of a product that can be added to a cart depending on the quantity that is left. my Html code is currently
<tr>
<th>quantity</th>
<td><input type="number" min="1" max="${product.stockQuantity}" value="1" name="qty" /></td>
</tr>
This does not limit the amount that can be added.
Upvotes: 0
Views: 994
Reputation: 361
I think you should use th:max
according to official documentation:
https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#setting-attribute-values
Upvotes: 1