I have a form in which there are many form fields which are dynamically being generated and I am trying to limit a numeric input field to a minimum and maximum value via the following code which isn't working in firefox
$products=getAllProducts();//an array of product objects
echo '<form method="POST" action="">';
for($i=0;$i<(count($products));$i++){
echo '<label>'.$products[$i].getName().'</label>';
echo '<input type="number" pattern="\d*" min="1" max="'.$products[$i].getAvailableQty().'" name="'.$products[$i].getId().'"></input>';
}
echo '<input id="cartButton" type="submit" value="Submit" formaction="cart.php" />';
echo '</form>';
Some one suggested me to use regular expressions but I don't know how to write a regular expression each time for a different a min value as 1 and max value as $products[$i].getAvailableQty()
value.Any help is appreciated