Jump to content

max value allowed in form field


paruby

Recommended Posts

I have form fields for the # of items of an object, ie. a shopping cart.  I want to be able to restrict a user to only enter a specific number range for the quantity of an item in the form field box.  I am not aware of a form field variable such as "maxvalue", but can I do it some other way?  I want to get the max number out of the database.  Not sure if this helps, but I am already using Ajax to set the form field values in database tables, but cannot seem to set a max value.

 

If this is not clear enough, let me know.

 

Thanks

 

Pete

Link to comment
https://forums.phpfreaks.com/topic/236597-max-value-allowed-in-form-field/
Share on other sites

OK, figured it out.  I am already making a call to my database to get item details, and the starting value of the field, so I just added another variable for the max value, and set that along to my JS/Ajax call, and it f the value of the field is greater than my max value, I change the field value back to the max, and send an alert msgbox to the screen.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.