Set Lightbox Section Initial Value

Hi!!! Love the calendar… thank you.

I am trying to set an initial value for a textbox that shows up in the lightbox form.

scheduler.config.lightbox.sections=[	
		{name:"name", height:20, map_to:"name", type:"textarea"}
...
...

So when the form shows up, I want the Name text area to be predefined as “Chris”, as an example.

How can I set an initial value?

Thanks!

Hello,

scheduler.attachEvent("onBeforeLightbox", function (event_id){ var ev = scheduler.getEvent(event_id); if(scheduler._new_event){ ev.text = "Chris"; } return true; });
Best regards,
Ilya

Thanks for your response, but I am uncertain how to get that code to work.

I have many form names on the lightbox that are already successfully mapped to mysql database through events_rec.php

I want the customer_ID textarea to be filled from a URL parameter using the GET method. So it’s initial value will be = $_GET[‘customer_ID’]

I tried adapting your code but no initial value was being filled.

Thanks.

	scheduler.config.lightbox.sections=[
										
		{name:"customer_ID", height:20, map_to:"customer_ID", type:"textarea"},
		{name:"description", height:130, map_to:"text", type:"textarea", focus:true},
		{name:"location", height:20, type:"select", map_to:"location", options:[
			{key:"", label:"None"},
			{key:"Area1", label:"Area1"},
			{key:"Area2", label:"Area2"},
			{key:"Area3", label:"Area3"},
			{key:"Area4", label:"Area4"}
			]},
		{name:"reason", height:20, type:"select", map_to:"reason", options:[
			{key:"", label:"None"},
			{key:"Other", label:"Other"},
			{key:"Test", label:"Test"},
			{key:"Service", label:"Service"},
			{key:"Follow-Up", label:"Follow-Up"}
			]},
		{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},
		{name:"time", height:72, type:"time", map_to:"auto"}
		]
	}

scheduler.attachEvent("onBeforeLightbox", function (event_id){ var ev = scheduler.getEvent(event_id); if(scheduler._new_event){ ev.customer_ID= "Chris"; } return true; });
Does it work exactly this way?

Best regards,
Ilya

YES, thanks! I have another question, I’ll start a separate thread.

this works but what if I only want to set the initial Value of one select section and not all.

scheduler.config.lightbox.sections = [ { name: "information", height: 110, map_to: "text", type: "my_editor" }, { name: "description", height: 50, map_to: "text", type: "textarea", focus: true }, { name: "Person", height: 23, type: "select", options: personSections, map_to: "PersonId" }, { name: "Person2", height: 23, type: "select", options: person2Sections, map_to: "Person2Id" }, { name: "action", height: 23, type: "select", options: sections, map_to: "ActionId" }, { name: "time", height: 72, type: "calendar_time", map_to: "auto" }

wherein I only want to change the initial value of person2, where person and person2 could have the same Id. It also affects the person section.

I am trying to use the Id for the element. Is it possible to set the Id?

Did you try what worked for me?

scheduler.attachEvent(“onBeforeLightbox”, function (event_id){
var ev = scheduler.getEvent(event_id);
if(scheduler._new_event){
ev.Person2= “whatever”;
}
return true;
});

Hello,

Check the Chris comment above with only one edit:

ev.Person2Id= "whatever";

as your “Person2” section is is mapped to ‘Person2Id’ property.

Best regards,
Ilya