ID of Select-Box in LightBox ?

Hello

I have a really simple question :slight_smile:
I have a new SELECT-Box in the Lightbox:

var termin = [
   { key: '1', label: 'Test 1' },
   { key: '2', label: 'Test 2' },
   { key: '3', label: 'Test 3' },
   { key: '4', label: 'Test 4' },
   { key: '5', label: 'Test 5' }
];

scheduler.config.lightbox.sections=[	
   {name:"description", height:23, map_to:"text", type:"select", options:section_wonr,  focus:true}, 
   {name:"termin", height:23, map_to:"termin", type:"select", options:termin},
   {name:"custom", height:23, map_to:"type", type:"select", options:sections},
   {name:"time", height:72, type:"time", map_to:"auto"}
];	

How can i see the ID the user choosed in “termin” ? I get the label with:

var A = scheduler.getLabel("termin", ID);

But where i get the ID?

Thank you

var ID = scheduler.getEvent(event_id).termin

where event_id - id of event in question ( can be taken from event handlers of getState command )

Thank you :slight_smile:

It works in the example above for the SELECT-Box “termin”. If i try for SELECT-Box “description” it doesn’t. Why? I tried:

var ID = scheduler.getEvent(event_id).section_wonr; // <----- this have to be the name of the array?

i just want the lable-text from the description Select-Box. I have to proove it before saving.
Thanks

Damn … this was a stupid mistake :frowning:
I took the array-name and it has to be the “map_to” parameter.
Everything fine :slight_smile:

ok … i give up :frowning:

I just get the Event-ID:

var A = scheduler._lightbox_id;
var B = scheduler.getEvent(A).text;
alert(B);

But i need it from what i selected in my SELECT-Box.
Can you give me an example what you mean with this “getState” function?

Thank you


Values which you can get through getEvent is saved properties, changes in the editor is not reflected while lightbox is open. In moment when lightbox is just opened getEvent will return exactly the same value as in the lightbox, but if you have changed something - you need to use different API

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

Can you give me an example what you mean with this “getState” function?
This is legal way to get the lightbox_id

var A = scheduler.getState().lightbox_id;

I need to proove selection before saving.

If i write this

var value = scheduler.formSection('description').getValue();
alert(value);

there happens nothing when i push the “save” button :frowning:

a) in above code ‘description’ - must be the name of section ( not map_to )

b)

I need to proove selection before saving.
scheduler.attachEvent(“onEventSave”, function(id, data){
if (some_check(data.text)) return false;
return true;
});

Here , instead of getEvent we are using second parameter, which is the hash of data, as it will be after event final saving.

But if i understand you right the name is correct, or ?!

scheduler.config.lightbox.sections=[
   {name:"description", height:23, map_to:"text", type:"select", options:section_wonr, focus:true},   
   {name:"termin", height:23, map_to:"termin", type:"select", options:termin},
   {name:"custom", height:23, map_to:"type", type:"select", options:sections},
   {name:"time", height:72, type:"time", map_to:"auto"}
];	

I have to bind in a special API?
Seems like he don’t know that function.

Yep, the config is correct, and scheduler.formSection(‘description’).getValue() must return value of the first section in your config.

Beware that form-sections api was introduced only in version 3.0 and will not work for older ones.

hmm :frowning:

I work with version 2.3
To work with version 3.0 i just have to replace “dhtmlxscheduler.js” or another file?

Anyway there is another way to get the sections value in version 2.3?
I made some modifications and i don’t really want to write that all new :frowning:

To update you need only replace js and css files - api is backward compatible.
In version 2.3 you can do it through onEventSave handler or use inner API, like

var data = scheduler._lightbox_out({id:scheduler._lightbox_id});

Thank you … this is what i was searching for :slight_smile: