Jump to content

PHP Validation for numeric entry


movingelite

Recommended Posts

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  ;D

 

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

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.