Validate::dbValues syntax
Validate::dbValues syntax
Field::inst( 'clients.CodePostal' )
// Run OK
->validator( 'Validate::dbValues', array( 'table' => 'communes', 'column' => 'CodePostal', 'message' => 'un code postal valide est requis' ) )
// don't run
->validator(
Validate::dbValues( ValidateOptions::inst()
->table( 'communes' )
->column( 'CodePostal' )
->message( 'un code postal valide est requis' )
)
)
->setFormatter( 'Format::ifEmpty', null )
,
Where is the problem ?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What does "don't run" mean? What happens? Do you see any error message? What debugging have you done?
hi @tangerine
Yes I get
DataTables warning: table id=CliTbl - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
Fatal error: Uncaught Error: Call to undefined method DataTables\Editor\ValidateOptions::table()
Writing this make me see there is not options defined...
trying
is not better
just DataTables warning: table id=CliTbl - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
Did you follow the steps at the link in the error?
http://datatables.net/tn/1
Let us know what you find.
Kevin
Hi Kevin
Yes I did but
using
breakpoint at validate.php line 1012...
trying to go in step by step crash (get no answer at all)...
Hi @kthorngren @allan
As discussed, dbValues validator does not run using syntax as:
Only ->message is accepted to work with dbValues
I think it is an error from me, but...
Using this syntax
run correctly
Do you know where I'm wrong ?
Please let me know...
Regards
Bob
Hi Bob,
The syntax being used there is wrong - you need to pass the table / column information into the
dbValues()
function (see the source):Allan