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_TopicIcon
beforeSubmit Event
13/06/2009
21:32
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Hi,

I'm attempting to to check some data before the actual submit to the database occurs.  Essentially I have date, start and finish time, and a lunch break.  I need to check a few things including if the person has already said that they worked during that time.  For that I need to jump to my database and a script called ValidateTimeEntry.php takes care of that.  It returns a string in xhr of boolean:string (ie : "true:" or "false:Start is greater than Finish" )

The value is being returned correctly but I am expecting the event o push the error to the form, or submit the form if there is no error. Here's the code I am using for the beforeSubmit event:

beforeSubmit:function(pdata){

//          return [false,"Some Message"];
            var aurl = "/actions/ValidateTimeEntry.php";
            jQuery.post(aurl,{DATE:pdata.DATE,START:pdata.START,FINISH:pdata.FINISH,LUNCH:pdata.LUNCH},function(xhr){
                var splits = xhr.split(":");
                if(splits[0] == "TRUE"){
                    //jQuery("#dialogPM").dialog('open');   
                    return[true];
                }else{
                    //some error has occured - post the message to the dialog
                    //jQuery(grid).trigger("reloadGrid");
                return[false,splits[1]];
                }
                });
        }

i'm not to sure why the event is not cancelled or the message posted, or why the data is not submitted.  To me it seems like xhr is local to just the ajax post and does not push back to actual beforeSubmit event. Any suggestions on how to fix this ?

Nathan

13/06/2009
22:07
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Not to sure if this is related but firebug keeps reporting the same issue:

ret is undefined
[Image Can Not Be Found] if(ret[0]) {
grid.formedit.js line 279
Using version 3.4.2 of the grid.
Nathan

14/06/2009
08:13
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Hey, nevermind, I resolved the issue.  It occured to me that I can assign the response from the script to a variable in javascript within the beforeSubmit event and then process my request accordiningly.

Solutions always occur after you've posted something. 

N

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
36 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