Custom Error Message
Custom Error Message
map@odenterprise.org
Posts: 14Questions: 4Answers: 0
Hello,
I am trying to give a custom error message in the editor while using the 'Validate::dbValues' validator. It is still showing the
"A system error has occurred (More information)" Error message.
Here is my code -
Field::inst( 'org_profiles.industry_id' )
->validator( 'Validate::dbValues', array( 'message' => "Value not valid!" ) ),
Thanks for the help!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Mis-read the question. Sorry.
That error means that valid JSON is not being returned from the server. Have a look with your browser's developer tools to see what is actually being sent back. Likely there is an error message stating what is going wrong.
Allan
Thanks for the replies. I just realised that my code is giving an error when I use ->validator( 'Validate::dbValues'). The staff.php in the network tab of the console shows the following error even when I enter a value which is present in the database. This is the error -
Fatal error: Call to a member function table() on a non-object in /var/www/html/survey/templates/dbadmin/Datatables-editor/php/Editor/Validate.php on line 931
Line 931 is
Could you please help me solve this? Thanks!
Could you add a
table
option into the array where you are currently passing in the custom message please? It should be the table that you want to check the value against. You might also need to have a field property for the column.Allan
Hi Allan,
Thanks for the solution. I have made the following change and it works perfectly. Even the custom message is being displayed.
Thanks a ton for the excellent support!