Forum


21:32

20/03/2009

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
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66