Forum



08:07

05/09/2011

Hello, I am using jqgrid plugin and I want to show messages of validations that I specific in the editing script, for example this message "you don´t have permission to execute this work", but I don´t know how, I have been reading the documentation and I think that I have to use the event "aftersubmit", but I would like to get an example, the messages that I need to show have to appear after to press the button submit.
Here is an example of the file from server side which shows messages
<?php
echo "This is the message to show after to press button submit";
?>
In conclusion I need to show messages from server side when editing.
00:00

20/08/2011

you can display server response messages from the edit, add, del jqgrid dialogs using one or more of the form edit events such as: afterSubmit. take a look at the events table on the docs link: http://www.trirand.com/jqgridw.....rm_editing , You would need to create the function that gets fired after the dialog is submitted. Here is an example…
on the client side:
var deleteMessage = function(response,postdata){
var json = response.responseText; // response text is returned from server.
var result = JSON.parse(json); // convert json object into javascript object.
return [result.status,result.message,null];
}
{view:true, closeOnEscape:true}, // general parameters.
{}, // edit options.
{}, // add options.
{afterSubmit: deleteMessage}, // del options.
{}, // search options.
{} // view options.
);
On the server side:
<? php
$rows = mysql_affected_rows();
// if record deleted or not, send user a status message.
if($rows == 1) {
// send status message and response to jqgrid.
$message = 'Workorder record '.$postConfig['rowID'].' deleted';
$output['status'] = true;
$output['message'] = $message;
}else{
// send status message and response to jqgrid.
$message = 'Workorder record '.$postConfig['rowID'].' not deleted';
$output['status'] = false;
$output['message'] = $message;
}
// encode to json format and send output back to jqGrid table.
echo json_encode($output);
?>
Most Users Ever Online: 715
Currently Online:
42 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66