This form sets a minimum and maximum value of 4 selections for a single product. You may set either limits by changing the line in the script
if(boxChecked < 4) to your number for the minimum or
if(boxChecked > 4) for the maximum.
This script only works with individual checkboxes and not using a text box for the quantity.