Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Preston on Aug 24, 2009 03:52
open dhtmlx forum
dhtmlscheduler how to write extras to db

Hi, I have a query about the method of doing some extra writting in your scheduler system.

I am passing an ID called taskId to the schedule page, the next schedule event made will be for this task. I am passing the variable without problem but am a bit lost on what to do with it now. Is it possible to pass this variable with the other details when the even is created/saved? The only other idea I have of doing it is to get the last updated id and pass that plus my taskId variable to a new php file that updates the db record.

Thanks.
Answer posted by Support on Aug 24, 2009 04:04
>>I am passing an ID called taskId
You can use the same war in the link to the dataprocessor

var dp = new dataProcessor("events.php?taskId=<?php echo $_GET['taksId']; ?>");

and on server side

function my_code($action){
         $action->add_field("taskId",$_GET["taskId"]);
}
$scheduler->event->attach("beforeProcessing","my_code"); //called before render_table

Above code is written for the PHP, but similar approach can be used for any other platform.
Above code sends taskId as part of dataprocessor's URL, and on server side, before any operation - additional field will be registered to be used in all queries. 
Instead of $action->add_field you can use any custom code for taskId saving

Also, if you having taskId in session - you can take it directly from session, in my_code method, it will be a more secure solution. 

Answer posted by Preston on Aug 24, 2009 04:35
Thanks for the quick reply.

I have put the code you provided in and am now passing the id to the events.php file (firebug showing it passed) but it is not being written to the DB with the rest of the details.  Do I till have to write that part or should it be writting the id due to the add_field statement adding the field to the table?
Answer posted by Preston on Aug 24, 2009 04:40
Wish I could edit.  Just did a quick search on add_field and realised i'd got the ordering wrong.

Thanks.
Answer posted by Support on Aug 25, 2009 02:47
>> Do I till have to write that part or should it be writting the id due to the add_field statement adding the field to the table?
You need not any extra code, add_field command register extra field name and its value, so insert|update command will automatically include it in the sql command