Hello,
I have added a radio button to the lightbox and would like that, when change this button option, the lightbox hide or block a field (a combo box or select).
The code I have written hide the field i have choosen but only when I close and open again the light box. It is not working dynamicaly.
thanks in advance!
var array = document.getElementById(‘myForm’).elements.namedItem(‘clientes’).value;
var clientes = (new Function(“return [” + array + “];”)());
var opcoes = [{ key: ‘Consulta’, label: ‘Consulta’ }, { key: ‘Compromisso’, label: ‘Compromisso’ }];
scheduler.config.lightbox.sections=[
{name:“Evento”, height:58, options:opcoes, map_to:“opcoes”, type:“radio”, vertical:true, default_value: “Consulta”},
{name:“cliente”, options:clientes, map_to:“cliente_id”, type:“select”, image_path:"…/resources/codebase/imgs/dhxcombo/", height:30, filtering:true, focus:true},
{name:“Observação”, height:50, map_to:“observacao”, type:“textarea” },
{name:“time”, height:72, type:“calendar_time”, map_to:“auto”}
];
function onRadioClick(event){
var e = event || window.event,
node = this;
dhtmlx.message(node.value);
if (node.value == 'Compromisso') {
alert(node.value);
scheduler.form_blocks.select.set_value = function(node, value, ev) {
node.firstChild.value = value || "";
var style = ev.cliente ? "block" : "none";
node.style.display = style; // editor area
node.previousSibling.style.display = style; //section header
scheduler.setLightboxSize(); //correct size of lightbox
};
}
}
scheduler.attachEvent(“onLightbox”, function(){
var node = scheduler.formSection(“Evento”).node;
var radios = node.getElementsByTagName(“input”);
for(var i = 0; i < radios.length; i++){
radios[i].onclick = onRadioClick;
}
});