Probable bug on Validate::numeric
Probable bug on Validate::numeric
nessinits
Posts: 86Questions: 27Answers: 0
in Bug reports
Field::inst( 'am_templates.title' )
->validator( Validate::numeric(ValidateOptions::inst() ->message('Numeric only') ) )
Leads to:
Catchable fatal error: Object of class DataTables\Editor\ValidateOptions could not be converted to string in /datatables/php/lib/Editor/Validate.php on line 422
Is this a bug?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The first parameter to be passed into the
Validate::numeric()
function should be the decimal place character, not aValidateOptions
instance - e.g.:It looks like the PHP validation documentation misses that - sorry! I'll have it corrected forthwith.
Allan
Its fixed now.
Regards,
Allan
I had to use
or it would throw the same error. I am using version 1.9.2
That looks correct if you are using a
minNum
validator. The error above was for thenumeric
validator.Allan
Thanks allan, though I was mentioning it because the current example at https://editor.datatables.net/manual/php/validation#Examples confused me.