I need some help with recurring events

Hi
I’m trying to implement recurring events in my scheduler, but for some reason it doesn’t write in my database.
I’ve got the following php code:

$list = new OptionsConnector($res, $dbtype);
$sql = “SELECT lp_id as value, lp_title as label from lesson_plan WHERE lp_owner_id = '”.$user_id."’";
$list->render_sql($sql,“value”,“value,label”);
$scheduler = new schedulerConnector($res, $dbtype);
$scheduler->set_options(“lesson_id”, $list);

$scheduler->filter("ev_user_id", $_SESSION['id']);

$scheduler->event->attach("beforeProcessing","default_values");

$scheduler->render_table("events", "event_id","start_date,end_date,event_name,lesson_id,ev_user_id,rec_type,event_pid,event_length");

I keep getting this error: "Uncaught TypeError: Cannot read property ‘id’ of undefined ".

I also have the log for this error:

start_date => 2014-01-20 09:40
end_date => 2014-01-20 11:10
event_name => New lesson
event_id => 1390226932860
event_pid =>
event_length =>
rec_pattern =>
rec_type =>
!nativeeditor_status => inserted
ev_user_id => 1

Incorrect field name used: lesson_id

data
start_date => 2014-01-20 09:40
end_date => 2014-01-20 11:10
event_name => New lesson
event_id => 1390226932860
event_pid =>
event_length =>
rec_pattern =>
rec_type =>
!nativeeditor_status => inserted
ev_user_id => 1

INSERT INTO events(start_date,end_date,event_name,lesson_id,ev_user_id,rec_type,event_pid,event_length) VALUES (‘2014-01-20 09:40’,‘2014-01-20 11:10’,‘New lesson’,’’,‘1’,’’,’’,’’)

Thanks in advance for any help

Have you tried to run the above sql directly against database ( it looks fine for me ) ?
Also, the message “Incorrect field name used: lesson_id” in the log is most probably related to the code of “default_values” function, can you share it please

The code creates events fine with the correct value for lesson_id selected from the drop down box, if I’m not using the recurring option.
This is my default_values function:

function default_values($action){

	global $user_id;

	$event_type = $action->get_value("ev_user_id");
	if ($event_type == "")
		$ev_user_id = $user_id;
		
	$action->set_value("ev_user_id",$user_id);
}

if I’m not using the recurring option.
The above posted log shows data saving of event without recurring mode selected.
Are you sure that those is the log data for the problematic data saving ?

positive. I’ve just created another one and if I don’t use the recurring option creates records in database.
this is my php code:

<?php session_start(); $user_id = $_SESSION['id']; //require_once('../../common/connector/scheduler_connector.php'); require_once('../../../codebase1/scheduler_connector.php'); include ('../../common/config_new.php'); function default_values($action){ global $user_id; $event_type = $action->get_value("ev_user_id"); if ($event_type == "") $ev_user_id = $user_id; $action->set_value("ev_user_id",$user_id); } $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); $list = new OptionsConnector($res, $dbtype); $sql = "SELECT lp_id as value, lp_title as label from lesson_plan WHERE lp_owner_id = '".$user_id."'"; $list->render_sql($sql,"value","value,label"); $scheduler = new schedulerConnector($res, $dbtype); $scheduler->set_options("lesson_id", $list); $scheduler->enable_log("log.txt",true); $scheduler->filter("ev_user_id", $_SESSION['id']); $scheduler->event->attach("beforeProcessing","default_values"); $scheduler->render_table("events", "event_id","start_date,end_date,event_name,lesson_id,ev_user_id,rec_type,event_pid,event_length"); ?>

I have checked the above code locally and it works fine for me :frowning:
Can you please try the next

  • delete log file
  • open scheduler and create recurring event
  • check the log file, does it have the sql code for insert command ? does it contains some values for the rec_type field ? is the sql code valid ?

The only idea which I have - there is some error on client side, when recurring event created, so the server side code not processed at all.

it must be on client side because when I click on save I only get the error in the console and it doesn’t run the php code. Practically it doesn’t do anything if I select any recurring option

Do you have some custom events attached to the scheduler ?
What is the configuration of lightbox ?

Any chances of live demo, where problem can be checked ?

The page is live at:
bootadmin.shooflypublishing.co.u … etable.php
This is the script in my html page

<script type="text/javascript">

scheduler.templates.event_text = function(s,e,ev){
return ‘’+ev.text+’’;
};

You need to have a time section in the scheduler’s config

scheduler.config.lightbox.sections = [ {name: "lesson_id", height: 21, map_to: "lesson_id", type: "select", options: scheduler.serverList("lesson_id")}, {name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"}, { name: "time", height: 72, type: "time", map_to: "auto" } ];

cheers Stanislav. That was the problem.