movingelite Posted February 4, 2011 Share Posted February 4, 2011 Good Morning, We recently had a Joomla based component designed for our company and we're having a validation issue. Our programmer is on vacation for a week so we're seeking some assistance adjusting the rule. The field is a numeric entry called "Minimum Hours" and should receive a user input of 1, 2, 3 or 4. The problem is that 0 is allowed but shouldn't be. I pulled the snipet below from the component php file which I believe likely contains the verification rule. The problem is that I don't know php or how to adjust the rule. I'm sure I could try a few common sense approaches but I'd prefer not to screw up the application Any input would greatly be appreciated! if(isNaN($('#minimum_hours_charge').val()) || $.trim($('#minimum_hours_charge').val()).length==0 || parseInt($('#minimum_hours_charge').val())<0) { $('#minimum_hours_charge').get(0).focus(); return false; } Link to comment https://forums.phpfreaks.com/topic/226687-php-validation-for-numeric-entry/ Share on other sites More sharing options...
JAY6390 Posted February 4, 2011 Share Posted February 4, 2011 That's javascript not PHP The likely change you will need to make is to change parseInt($('#minimum_hours_charge').val())<0 so that 0 is 1 Link to comment https://forums.phpfreaks.com/topic/226687-php-validation-for-numeric-entry/#findComment-1169869 Share on other sites More sharing options...
movingelite Posted February 4, 2011 Author Share Posted February 4, 2011 Hi Jay, Sorry, I guess I really showed how little I know! I appreciate the info, that did work. That was also my common sense guess but as I mentioned I didn't want to mess anything up. I appreciate it! Link to comment https://forums.phpfreaks.com/topic/226687-php-validation-for-numeric-entry/#findComment-1169894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.