Form fields with database save


First of all: sorry for my bad english.

I read the documentation, but i didn’t understand a lot.

If i create with a dblclick a new Event, i need more form fields. Importent is to connect these fields with tha database (PHP). I have no idea :frowning: !

I have downloaded a PHP example from dhtmlx. It work’s, but only for the three standart fields. I don’t know how i can create new fields which i can save in the database.

Thank you for your help.

You need to

a) add new sections to the lightbox
b) add new names in last parameter of render_table command in the php file ( this is the list of fields to be updated )
c) in lightbox config use same names for map_to as names of fields in the database. … ils_form&s[]=scheduler&s[]=lightbox#mapping_db_fields_to_the_form

Hi Stanislav,

thank you for your answer.

a) ok, new sections like this example: … ils_form&s ?

b) which php file? In the example the scheduler.load("…events.php?uid="+scheduler.uid()) ?? For example…events.php?uid="+scheduler.uid()+"&nextparam="+something… like this?

c) ok…i understand.

Thank you for your help.

Ok…i have in my index.html now:

	    {name:"user", height:130, map_to:"user", type:"textarea" , focus:true},
		{name:"description", height:130, map_to:"text", type:"textarea" },
		{name:"location", height:43, type:"textarea", map_to:"details" },
        {name:"reccuring", height:21, type:"select", map_to:"rec_type", options:[
	     {key:"offen", label:"Offen"},
	     {key:"steht", label:"Steht"}
		{name:"time", height:72, type:"time", map_to:"auto"}

and i call


in the events.php i have change the sql statement to

$scheduler->render_sql("select * from events_shared where userId = ".$user_id,“event_id”,“start_date,end_date,text,details,user,rec_type,event_type,userId”);

but nothing happend. I can’t save. I see the form fields, but that is all :frowning: !

Thank you.

The code looks correct and must work

a) be sure that related table in DB has all fields mentioned in the command
b) rec_type is used for recurring events by scheduler, there is some risk of interference, so it may be better to rename the field

If it still doesn’t work, try to change your code as

if ($scheduler->is_select_mode()) $scheduler->render_sql("select * from events_shared where userId = ".$user_id,"event_id","start_date,end_date,text,details,user,rec_type,event_type,userId"); else $scheduler->render_table("events_shared","event_id","start_date,end_date,text,details,user,rec_type,event_type,userId");

You can enable logging to get more info about connector errors … nd_logging


ok…the problem is that i show the database values from 1-2 fields, but not all and i can’t save. I believe the problem is in the php file. The php file:

<?php include ('../../codebase/connector/scheduler_connector.php'); include ('../../samples/common/config.php'); $res=mysql_connect($server, $user, $pass); mysql_select_db($db_name); $user_id = intval($_GET['user']); $scheduler = new schedulerConnector($res); $scheduler->enable_log("log.txt",true); if ($scheduler->is_select_mode()) $scheduler->render_sql("select * from events_shared where userId = ".$user_id,"event_id","start_date,end_date,text,user,details,reccuring,event_type,userId"); else $scheduler->render_table("events_shared","event_id","event_id","start_date,end_date,text,user,details,reccuring,event_type,userId"); ?>

I rename rec_type to reccuring . Screenshot of my table


I solved the problem…i wrote one of the fields wrong and i forgott a semicolon… :unamused: !

Thank you very much for your help.