Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Help to show messages from side server when validating
05/09/2011
08:07
Avatar
sebastiancb
COlombia
Member
Members
Forum Posts: 23
Member Since:
05/09/2011
sp_UserOfflineSmall Offline

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.

17/09/2011
00:00
Avatar
nelsonm
Michigan, USA
Member
Members
Forum Posts: 106
Member Since:
20/08/2011
sp_UserOfflineSmall Offline

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:

    // define handler function for 'afterSubmit' event.
    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];
    }

    $('#tab3-grid').jqGrid('navGrid', '#tab3-pager',
        {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);

?>

18/09/2011
09:47
Avatar
sebastiancb
COlombia
Member
Members
Forum Posts: 23
Member Since:
05/09/2011
sp_UserOfflineSmall Offline

Thank you, it works perfectly

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information