• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validation DECIMAL [parameters ???]

#1
[eluser]cPage[/eluser]
How to use parameters for DECIMAL validation ?

#2
[eluser]jprateragg[/eluser]
How do you want to validate it? You'll probably have to write your own helper function and call it in your form validation rules for that specific field. That's what I had to do for my application.

#3
[eluser]cPage[/eluser]
Quote:decimal parameters Yes Returns FALSE if the form element is not exactly the parameter value.

I've tested it , and its fine to validate a decimal number without parameters. But i thought that maybe parameters will validate the format.

For example if i want only 2 digits after the dot like 0.99, MySQL can validate it anyway.

#4
[eluser]jprateragg[/eluser]
Well, you have two options. You can extend the form_validation class (MY_form_validation) and modify the decimal function, or you can create a helper function, name it something like 'dec_len($data, $length), and call that function in the form validation rules. In your rules, you would reference it simply as "function[2]", the number being the number of digits after the decimal you require.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.