display sql error in add/edit after submit

Questionsdisplay sql error in add/edit after submit
varun asked 7 years ago

How to display error message in add/edit form,if given Primary Key ID is present i want error saying 'cont add'.Is it Possible?

7 Answers
Abu Ghufran answered 7 years ago

You can use phpgrid_error("Error message"); on server side.
Please refer sample editing > server validation for working demo.

shri answered 6 years ago


when user make mistake while adding record it shows error with dml query, i want to hide this, how can i do the same?

Abu Ghufran answered 6 years ago

You need to set debug = 0;

$g = new jqgrid();
$g->debug = 0;

You can also change generic error message.
$g->error_msg = "Some issues occured in this operation, Contact technical support for help";

varun answered 6 years ago

Hi Abu,
Setting debug=0 wont it stop all errors from displaying?

Abu Ghufran answered 6 years ago

It will replace all error messages (dml etc) with your provided error text.

If you wish to remove the error displaying dialog (which is not recommended)
you can edit jqgrid_dist.php and remove following:

// on error
$out .= ",'loadError': function(xhr,status, err) {
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+ xhr.responseText +'</div>',

catch(e) { alert(xhr.responseText);}

Abu Ghufran answered 6 years ago

You can refer demos/ediitng/server-validation.php samle code for duplicate record check.

shri answered 6 years ago

Thx alot,

But i want to show errors on duplicate records, how to customize?
should i add in add_client ?

Your Answer

20 + 16 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?