paruby Posted May 17, 2011 Share Posted May 17, 2011 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 More sharing options...
paruby Posted May 17, 2011 Author Share Posted May 17, 2011 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. Link to comment https://forums.phpfreaks.com/topic/236597-max-value-allowed-in-form-field/#findComment-1216323 Share on other sites More sharing options...
cssfreakie Posted May 17, 2011 Share Posted May 17, 2011 Note though: this is client side stuff, so don't rely on it, always check server side if the values are as expected. Link to comment https://forums.phpfreaks.com/topic/236597-max-value-allowed-in-form-field/#findComment-1216573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.