Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by rencin on Dec 14, 2009 00:21
open dhtmlx forum
added radio button and checkbox in the event window

Hi,

In dhtmlxscheduler ,using custom details form i added radio button and checkbox in the event window as shown below.

scheduler.form_blocks["my_editor"]= {
render:function(sns) {

return "<div class='dhx_cal_ltext' style='height:40px;'><input type='radio' name='r1' value='GM'>GM  <input type='radio' name='r1' value='SR'>SR  <input type='radio' name='r1' value='HE'>HE   <br/> I agree   <input type='checkbox' value='1'> </div>";

},

set_value:function(node,value,ev) {

node.childNodes[1].value= value||"";
node.childNodes[4].value= value||"";
node.childNodes[7].value= value||"";

}
get_value:function(node,ev){


ev.r1[0] = node.childNodes[1].value;
ev.r1[1] = node.childNodes[4].value;
ev.r1[2] = node.childNodes[7].value;
ev.chk = node.childNodes[10].value;
return ev.chk;
}

}
scheduler.config.lightbox.sections=[    
        { name:"description", height:50, map_to:"text", type:"textarea" , focus:true},
{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},
{ name:"detail", height:20, type:"my_editor" , map_to:"r1", focus:false },
    { name:"time", height:72, type:"time", map_to:"auto"}]


1. But javascript errors such as : " ' Object doesnot surpport this property or method ' ; ' r1 is null or not an object ' ; " are shown in browser . how to slove it?

2. How to make valdation for whether a radion button and checkbox are checked using " scheduler.attachEvent("onEventSave",function(id,data) { } " ?


regards
rencin
Answer posted on Dec 14, 2009 00:30

Hello,

probably r1 is actually isn't defined:

...

get_value:function(node,ev){

if(!ev.r1) ev.r1 = [];

...

}

Answer posted by Alex (support) on Dec 14, 2009 00:34

>> How to make valdation for whether a radion button and checkbox are checked using " scheduler.attachEvent("onEventSave",function(id,data) { } " ?

It is possible to get event object by id: 

var eventObj = scheduler.getEvent(eventId);

You can check the property of the event. For exampke if you have assigned radio_checked property to the event, you can check it:

if(scheduler.getEvent(eventId).radio_checked) /* ... */