• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: How to limit a fields data to a range of numbers

How to limit a fields data to a range of numbers 12 years 2 months ago #21430

  • xover15
  • xover15's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 1
I've seen the javascript to limit a field to a number of characters. I need to find a way to limit a field to a range of numbers. The goal would be to limit someones submission from 50 to 100. If their number didn't fall in that range it would not allow it or would give an error.

I've found that javascript has a Math.min Math.max, but i'm not sure if this could be applied. Would this be triggered on submission of on onkeyup?

thanks for any help!
The administrator has disabled public write access.

How to limit a fields data to a range of numbers 12 years 2 months ago #21580

  • xover15
  • xover15's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 1
Is there a different way to limit what is input into a field besides javascript? Something to the affect of if this is input, it shows an error and won't submit. Similar to what would happen if you left a required field blank.
The administrator has disabled public write access.

How to limit a fields data to a range of numbers 12 years 2 months ago #21605

  • xover15
  • xover15's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 1
For anyone trying to accomplish something similar, I ended up adding javascript to the validation.php file which worked out better because it integrated into the forms field errors.

Example Code
 // Custom Edit for Percentages //
 
	function validname($param,$extra = null)   
{
     if($param < 90 || $param > 100)
        return false;
      return true;
}
The administrator has disabled public write access.
The following user(s) said Thank You: kendjr
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!