Thank you, it works! Though I did in a dirtier way.
But now a huge problem…
Lightbox combos are fille base on a query on top of the page.
One of them may vary, based on what the user does on the lightbox, because he can insert directly a new custome (here called “paziente”), so i thought to redo the query on onbeforelightbox to get the list refreshed with the new value inserted, but no luck… where am I wrong?
Sorry if i paste the whole section, but i’d like to be understood correctly
[code] scheduler.attachEvent(“onBeforeLightbox”, function(){
//alert(‘Ciao’);
//scheduler._lightbox = null;
//window.setTimeout(“window.location.reload(true);”, 1000);
//scheduler.resetLightbox();
if (scheduler._new_event) {
// ################################### FORM NUOVO PAZIENTE
<?
// Pazienti
$qs=“SELECT id,cognome,nome FROM pazienti ORDER BY cognome”;
$rs=mysql_query($qs) or die(mysql_error());
$righe_p= <<<RP
{key:0, label:“Nuovo Paziente (box sottostante)”},
RP;
while ($ds=mysql_fetch_assoc($rs)) {
$id=$ds['id'];
$nominativo=$ds['cognome']." ".substr($ds['nome'],0,1).".";
$righe_p.= <<<RG
{key:$id, label:"$nominativo"},
RG;
}
$righe_p=substr($righe_p,0,-1);
?>
//alert ('NUOVO');
scheduler.templates.lightbox_header = function(start, end, event){
return "Nuova Terapia";
}
scheduler.config.lightbox.sections=[
//{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
//{name:"custom", height:23, type:"select", options:"paziente_id", map_to:"id_paziente"},
{name:"paziente", height:25, type:"select", map_to:"id_paz", options:[
<?=$righe_p?>
]},
/*
{name:"paziente", height:21, map_to:"id_paz", type:"select",
options:scheduler.serverList("id_paz")},
*/
{name:"cognome", height:15, type:"textarea", map_to:"cognome"},
{name:"telefono", height:15, type:"textarea", map_to:"telefono"},
{name:"terapia", height:25, type:"select", map_to:"id_prest", options:[
<?=$righe_t?>
]},
{name:"medico", height:25, type:"select", map_to:"id_medico", options:[
<?=$righe_m?>
]},
//{name:"stanza", height:25, type:"select", map_to:"id_stanza", options:[
//<?=$righe?>
//]},
{name:"Note", height:30, type:"textarea", map_to:"Note"},
{name:"time", height:20, type:"time", map_to:"auto"}
]
} else {
// ################################### FORM MOD PAZIENTE
<?
// Pazienti
$qs="SELECT id,cognome,nome FROM pazienti ORDER BY cognome";
$rs=mysql_query($qs) or die(mysql_error());
$righe_p= "";
while ($ds=mysql_fetch_assoc($rs)) {
$id=$ds['id'];
$nominativo=$ds['cognome']." ".substr($ds['nome'],0,1).".";
$righe_p.= <<<RG
{key:$id, label:"$nominativo"},
RG;
}
$righe_p=substr($righe_p,0,-1);
?>
//alert ('MOD');
scheduler.templates.lightbox_header = function(start, end, event){
return "Modifica Terapia";
}
scheduler.config.lightbox.sections=[
//{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
//{name:"custom", height:23, type:"select", options:"paziente_id", map_to:"id_paziente"},
{name:"paziente", height:25, type:"select", map_to:"id_paz", options:[
<?=$righe_p?>
]},
/*
{name:"paziente", height:21, map_to:"id_paz", type:"select",
options:scheduler.serverList("id_paz")},
{name:"cognome", height:15, type:"textarea", map_to:"cognome"},
{name:"telefono", height:15, type:"textarea", map_to:"telefono"},
*/
{name:"terapia", height:25, type:"select", map_to:"id_prest", options:[
<?=$righe_t?>
]},
{name:"medico", height:25, type:"select", map_to:"id_medico", options:[
<?=$righe_m?>
]},
//{name:"stanza", height:25, type:"select", map_to:"id_stanza", options:[
//<?=$righe?>
//]},
{name:"Note", height:30, type:"textarea", map_to:"Note"},
{name:"time", height:20, type:"time", map_to:"auto"}
]
}
scheduler.resetLightbox();
return true;
});
[/code]
What I need is that the paziente fill when I edit show the right customer on the combo, but it doesn’t because it seems the query is not redone…
Could you please give a precious hint of yours?
I also tried with the option connector but i didn’t get it to work, maybe because I fetch data via php file…