php - jqgrid How to personalize the error status 'error'. error code 500 -


I am using CodeIgniter with the jquery grid. I have an index in my DB which states that some combination can not be included. Typical key user_store_index ( Store_idStores , Users_idUsers ). A combination of a user and a store can not be inserted twice. I can see the error a database error occurred using firebux error number: INSERT INTO asignedto ( Stores_idStores key for 'user_store_index' 1062. Duplicate entry '1-5' , user_idues ) value ('1', '5').

In this case, I would like the user to show the following message in jqGrid: "You can not insert it because it already exists" but I have found "error status: 'Error' error code: 500 ". I have read the descriptions presented here and here and many others, but I am not able to find solutions.

Here my jqGrid code

  $ (document) .ready (function () {var grid = jQuery ("# ​​newapi_1351802691"). JqGrid ({ajaxGridOptions is: {Type: "post"}, jsonReader: {root: "data", repeatitems: false}, loadError: function (XHR, status, error) {warning (xhr.status + ',' + position + ',' + error ); // Warning 500, error, my custom error}, line list: [10,20,30], viewer: true, url: 'http: //localhost/sp/index.php/assigment/getData', editurl : 'Http: //localhost/sp/index.php/assigment/setData', datatype: 'json', ROWNUM: '12', width: '800', height: '300', pager: '# pnewapi_1351802691', Title: 'Control de Ascnassi ', Username:' username ', index:' username ', label:' userari ', align:' left ', width: 300, editable: incorrect, attribute:' text ', adril: { Required: True}}, {Name: 'Store Name', Index: 'Store Name', Label: 'Tinda', Align: 'Center', Width: 200, Editable: Wrong, Editing: 'Text', Editorial : {Required: true}}, {name: 'users_idUsers', index: 'users_idUsers', label: 'Usuario', align: 'center', width: 100, hidden: correct, edit : True, edittype: Select '', editoptions: {value: "Select; 5: tienda1, 6: tienda2; 17: tienda3 ", size: 10}, editrules: {edithidden: true, essential: true, integer: true}}, {name: 'Stores_idStores', index: 'Stores_idStores', label: 'Tinda' , Align: 'center', width: 100, hidden: true, editable: true, edittype: 'select', editoptions: {value: ": select; 1: EA001; 3: EA003; 4: EA005; 5: EA006, 6: EA007, 7: EA008; 8: EA009; 9: EA010; 10: EA011; 11: EA012, 12: EA013; 13: EA015; 14: EA017; 15: EA018; 16: EA019; 17: EA020, 18: EA021, 19: EA022; 20: EA002; 21: EA000 ", Size: 10}, editrules: {edithidden: true, essential: true, integer: true}}, {name: 'सर्गेटर्न', index: 'सर्गेट turn', label: 'सर्टिडेट', align: 'Center', width: 100, key: true, hidden: true, edit editable: {hidden: true}}]}) jQuery ("# ​​newapi_1351802691"): true, edittype: 'select', editoptions : {Value: "select: 1: 1; 19: 19 ", size: 10} .jqGrid ('navGrid', '# pnewapi_1351802691', {view: false, edit: '1', add: '1', dell: '1', closed: Delfunc: null, search: ''} {reincarnation: true, width: 400, first showform: on the function (form) {}, closeAfterEdit: true}, // edit options {recreateForm: true, width: 400, closeAfterAdd: true Submit before: Function (PostData, Formid) {var mensaje = ''; var resultado = true; return [resultado, mensaje];}}, / * add option * / {mtype: 'POST'} / * delete option * /, {Sopt: ['eq', 'cn', 'ge', 'le'], multiple searches: wrong, showOnLoad: false, overlay: false, MTYPE: 'POST'} / * search v Lapse * /) .navButtonAdd ('# pnewapi_1351802691', {title: 'button button,' ui-icon-extlink ', onClickButton: dtgOpenExportdata, status:' last ', title:' export data ', cursor:' indicator ' });;});   

Can you please help me on this ...

You do not make better use of this kind of error

Reason:

  • You see" 500 errors "to CI DB is responding with error and returning the "500 internal server error" http header
  • this main The Hnkshn and displayed automatically, as long as you do not edit the core Mayscl library, then you can not change it.

    Try to add the distinction of the user's record every time and return some error to handle it in jqgrid

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -