type:select question

I’m trying to create an appointment type select list when creating an appt but on the code i have below i’m getting the correct number of items in the select list but the value is ‘null’ for all of them. any help would be appreciated, thanks.

In the connector file below if I uncomment this line: //$list->render_table("appttype","idkey","appttype(value),appttype(label)"); then it pulls the correct fields but I need to filter out the deleted types which is why i’m using the render_sql

html file:

[code]

html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; } .dhx_scale_hour{ line-height:normal; }
 
 
 
[/code]

connector file:

[code]<?php
require_once("…/codebase/connector/scheduler_connector.php");

$res=mysql_connect(“localhost”,"…","…");
mysql_select_db(“data00”);

$scheduler = new SchedulerConnector($res,“MySQL”);

$list = new OptionsConnector($res);
//$list->render_table(“appttype”,“idkey”,“appttype(value),appttype(label)”);
$list->render_sql(“select APPTTYPE, APPTCOLOR from appttype where APPTSTAT = ‘1’”, “IDKEY”,“APPTTYPE,APPTCOLOR”);
$scheduler->set_options(“type”, $list);

$scheduler->enable_log("…/scheduler/temp.log", true);

$scheduler->render_table(“events”,“event_id”,“start_date,end_date,details,event_type”);
?>[/code]

Change the render_sql command as

$list->render_sql("select APPTTYPE as value, APPTCOLOR as label from appttype where APPTSTAT = '1'", "IDKEY","APPTTYPE(value),APPTCOLOR(label)");

thanks

I have another question related to this…in the appttype table I also have a field that tells me what color the appointment should be based on the appointment type. How can I pass that value to the schedule.html page and then store that along with the ‘IDKEY’ value.

thanks

Its quite simple to load custom value to the client side - just add it to the list of fields in render_sql command , but there is no any public API, which will help to access that value on client side.

It may be a more simple solution to generate a list of css styles based on type-color relation, and later use type id in css class template of event.

docs.dhtmlx.com/doku.php?id=dhtm … appearance

Also, you can join the APPTTYPE table to events table for main render command, and select color info as part of event’s info ( not as part of options )

thanks, I used another render_sql command and now i’m able to insert new appoinments and it loads the correct color but when i edit or delete the appointment nothing happens.

Here’s the code i’m using on the connector.php page:

if ($scheduler->is_select_mode())//code for loading data $scheduler->render_sql("select * from events, appttype where events.event_type=appttype.IDKEY or events.event_type = ''", "events.event_id","start_date,end_date,details,event_type,event_notes,COLORDESC"); else $scheduler->render_table("events","event_id","start_date,end_date,details,event_type,event_notes");

and here’s the log:

the event_id doesn’t match up with what’s stored in the events table so that’s why it won’t updated/delete the appointments once they’re in there. Could you point me in the right direction? Not sure where to find this one.

thanks a lot.

Change code like next

$scheduler->render_sql(“select * from events, appttype where events.event_type=appttype.IDKEY or events.event_type = ‘’”, “events.event_id(event_id)”,“start_date,end_date,details,event_type,event_notes,COLORDESC”);

If you are using table name with field name as name of id or field, you need to define an alias which doesn’t include table name

thank you