Hide a Object in Ligthbox

Hi, i wish hide a object “select”, beacuse i need send ‘ISM’ to data base, i try with “hidden:1”, but i’d like another solution.

many thanks

MIke

Hello,

You don’t need extra lightbox section for that.
For example that select is mapped to ‘select’ field in the table then you can attach to any internal event (e.g. onEventSave) and assign additional property.

scheduler.attachEvent("onEventSave",function(id,data,is_new_event){ var event = scheduler.getEvent(id); event.select = 'ISM'; return true; })
Best regards,
Ilya

Thanks ILya, but i need that don’t show the object “select”, with this code select and ISM and appears…

Hello,

Edit your lightbox configuration and delete that section.

Best regards,
Ilya

Hi Ilya, I edit the Ligthbox Configuration , but show error: type is null, my original code is:

[code]function init()
{
scheduler.config.xml_date="%Y-%m-%d %H:%i"; // Formato ISO de Fecha manejado por el Scheduler
var SiglaLigthbox= “<?php echo $Sigla ?>”; // Obtengo la Sigla de la Sesiòn

var sections=[
    {key:SiglaLigthbox, label:SiglaLigthbox} //defino la Sigla como llave y etiqueta para el formulario
     ];

scheduler.config.lightbox.sections=[ // Se Configura el Formulario de Mantenimiento “LightBox”
{
name:“description”,
height:40,
map_to:“text”,
type:“textarea”,
focus:true
},
{
name:“location”,
height:20,
type:“textarea”,
map_to:“Lugar”
},
{
name:“time”,
height:20,
type:“time”,
map_to:“auto”
},
{
name:“sigla”,
height:1,
type:“select”,
options:sections,
map_to:“Sigla”
}
]

scheduler.config.first_hour=8; // hora inicio de actividades
scheduler.locale.labels.section_location=“Lugar”;
scheduler.locale.labels.section_sigla="";
scheduler.config.update_render=“true”;
scheduler.getLabel(“sigla”, SiglaLigthbox); // envio la sigla del colegio como valor predet.

scheduler.attachEvent(“onEventCreated”,function(id,e){
var date = scheduler.getEvent(id).start_date;
date.setHours(8); // hora inicial por defecto de nueva actividad
scheduler.getEvent(id).start_date = date;
var date1 = scheduler.getEvent(id).end_date;
date1.setHours(8); // hora final por defecto de nueva actividad
scheduler.getEvent(id).end_date = date1;
})

scheduler.init(‘scheduler_here’,null,“month”);
scheduler.clearAll();
scheduler.load(“events.php?uid=”+scheduler.uid()+(new Date()).valueOf());

var dp = new dataProcessor(“events.php”);
dp.init(scheduler);
scheduler.xy.scale_height = 30; //alto de la barra de escala del calendario
scheduler.xy.scale_width = 40; //ancho de la barra de escala del calendario
scheduler.config.event_duration = 30; // tiempo por defecto de duración de actividades
scheduler.config.auto_end_date = true; //la hora y fecha final
scheduler.config.multi_day = true;
scheduler.xy.scroll_width = 0;

}
[/code]

Where i should put ?

scheduler.attachEvent("onEventSave",function(id,data,is_new_event){ var event = scheduler.getEvent(id); event.select = 'ISM'; return true; })

Please help me

thanks

Mike

Hi Mike,
You can make your own form blocks, and they can appear however you would like them too. Below is the one I used on my scheduler for a hidden variable

        scheduler.form_blocks["hiddenInput"] = {
            render:function(sns) {
                return "<div style='height:1px; display:none; visibility:hidden;'><input id='" + sns.ctrlId + "' name='txtHiddenInput' type='text' /></div>";
            },
            set_value:function(node,value,ev) {
                node.childNodes[1].value = value || "";
            },
            get_value:function(node, ev) {
                return node.childNodes[1].value;
            },
            focus:function(node) {
                var a = node.childNodes[1];
                a.select();
                a.focus();
            }
        }

And when I use it in my lightbox section declaration, I implement the following code:

        scheduler.config.lightbox.sections = [
            { name: "yourControl", height: 20, map_to: "EventName", type: "hiddenInput", ctrlId: "yourControl" },        

And to hide it, I use the following code prior to executing the load command on the scheduler:

    scheduler.locale.labels.section_yourControl = "";

Also, you can place that event handling code before you call the following load code

		scheduler.init('scheduler_here', new Date(2009,7,21), "timeline");

You may want to review the documentation which the dhtmlx team has provided as it is quiet complete.
Kind regards
Greg

Hello, Greg :slight_smile:

Mike, you can use another approach to the solution - truly hidden input on the lightbox form as Greg suggested.

Or as I suggested earlier - simply setting property for the event before saving.
You should edit your lightbox configuration following way (this is updated code, simply copy and paste):

scheduler.config.lightbox.sections=[ // Se Configura el Formulario de Mantenimiento "LightBox" { name:"description", height:40, map_to:"text", type:"textarea", focus:true }, { name:"location", height:20, type:"textarea", map_to:"Lugar" }, { name:"time", height:20, type:"time", map_to:"auto" } ]
And place

scheduler.attachEvent("onEventSave",function(id,data,is_new_event){ var event = scheduler.getEvent(id); event.select = 'ISM'; return true; })
before scheduler’s init.

Best regards,
Ilya

Thanks Ilya, Thanks Greg…

Ilya when i can map to ‘Sigla’ with my hidenn object??, beacuse with this code:

scheduler.attachEvent("onEventSave",function(id,data,is_new_event){ var event = scheduler.getEvent(id); event.select = 'ISM'; return true; })

my field in the table save in blank,

thanks

Mike

Yes, sorry, in your case it should be like this:

scheduler.attachEvent("onEventSave",function(id,data,is_new_event){ var event = scheduler.getEvent(id); event.Sigla = 'ISM'; return true; })
Basically we are attaching additional property to the event which is linked to the field in the database.

Best regards,
Ilya

Thanks so much Ilya, work it ok , good job!!

Now i’m working with dhtmlxGrid in a new project, see you later :smiley:

hugs and best regards

Mike