"unedefined" when creating events

Hello there,

i am working with coustom templates for displaying events in day, week and month view, because i am using a custom lightboy with elements like FIRSTNAME, SECONDNAME and COMMENT…

These parameteres are displayed in my views, see here:
directupload.net/file/d/3769 … pk_jpg.htm

Now i got th eproblem, that when i create a new event, the default view is like this (directupload.net/file/d/3769 … 69_jpg.htm), before i finished creating the event.

I want to fix this, with anything, that looks better than this (for example, leave the texts blank before finisheing!) - But which function i need to access the pre-creation-display of events?

Best wishes,
Ben

By the way:

Working with the " default_value" parameter in lithbox.sections does not have any effect of the displaying of the event while lightbox is opened.

I made it a bit complicated, because i am using a part of a own editor like this:

return "<div class='dhx_cal_ltext' style='height:88px;'><table border='0' width='100%' cellpadding='0' style='margin-left: -2px;'><tr><td width='30%'><div>NACHNAME</div><div id='combo_zone_nachname' style='width:100%;'></div></td><td width='5%'></td><td width='30%'><div>FIRSTNAME</div><div id='combo_zone_vorname' style='width:100%;'></td><td width='5%'></td><td width='30%'><div>Telefon</div><div style='width:100%;' class='dhxcombo_dhx_skyblue'><input type='text' style='width:100%;' class='dhxcombo_input'></div></td></tr><tr><td colspan='5'><div style='margin-top: 5px;'>Bemerkung</div><div style='width: 100%' class='dhxcombo_dhx_skyblue'><input type='text' style='width:100%' class='dhxcombo_input'></div></td></tr></table><input type='hidden'></div><input type='hidden'></div>";

and after all, i also use a dhtmlx_combo for filling the NACHNAME and FIRSTNAME fields :-/
So i think i am looking for a function like “OnBeforeCreate” or soemthing to customize the event-displaying for unsaved events… Is there anything like that available? :slight_smile:

Okay, i am sorry for this, i found a way, through changing the
scheduler.templates.event_text Function a little bit:

[code]// prevent “unedfined”
if(!event.firstname) event.firstname = " ";
if(!event.lastname) event.lastname = " ";
return “your-event-displaying-routine”…[code]

I won’t delete this topic, because perhaps it can helps out someone else in future, okay?

Hi,
please avoid modifying the events inside the template functions. Templates are supposed to take some values as input and return an html string that will be used in the page. Using them to changing the external values may eventually lead to unexpected side effects.

If you want to avoid the ‘undefined’ labels, you can either prepare values before output them, or set an initial values when event is created:var firstname = event.firstname || "";//use an empty string if property is not set var lastname = event.lastname || "";ORscheduler.attachEvent("onEventCreated", function(id,e){ var ev = scheduler.getEvent(id); ev.firstname = "";// set initial values ev.lastname = ""; return true; });
docs.dhtmlx.com/scheduler/api__s … event.html

Thanks for your nice replay!

I think i did both of that solutions! I predefined the textboxes, when i create a new event (and it works, for the lightbox header for example) but in the background there are still the unedfined-labels for the same values, that worked in lightbox-header.

I also prepare value when lightbox gets opened, with something like this (whole function):

         set_value:function(node,value,ev){
                  
            var inps = node.getElementsByTagName("INPUT");
			if (!node.combos){
			   
			   var comboA = node.comboA = new dhtmlXCombo("combo_zone_nachname","dummy");
			   comboA.enableFilteringMode(true, "inc/combobox_nachname.php", true, true);
			   comboA.load("inc/combobox_nachname.php",function(){
				  comboA.setComboText(ev.nachname||"");
				  comboA.setComboValue(ev.nachname||"");
			   });
			   
			   var comboB = node.comboB = new dhtmlXCombo("combo_zone_vorname","dummy");
			   comboB.enableFilteringMode(true, "inc/combobox_vorname.php", true, true);
			   comboB.load("inc/combobox_vorname.php",function(){
				  comboB.setComboText(ev.vorname||"");
				  comboB.setComboValue(ev.vorname||"");
			   });
			   
			   node.combos = true; //added!  // CHANGED
			   
			} else {

					 node.comboA.setComboValue(ev.nachname||"");
					 node.comboB.setComboValue(ev.vorname||"");
			}

			node.comboA.setComboValue(ev.nachname||""); // CHANGED
			node.comboB.setComboValue(ev.vorname||""); // CHANGED
            
			inps[6].value=ev.telefon||"";
			inps[7].value=ev.bemerkung||"";
			inps[8].value=ev.user||"praxis";
               
         },

In german vorname == firstname, nachname == lastname…