formSection in lightbox not saving to DB

Hi,

I am trying to populate some fields in my light box based on user selected drop down. I can see the data being written to the field but it is not being updated in the DB. I am using onEventAdded but it still isn’t working. Any thought how to get it to work?

// lightbox
scheduler.config.lightbox.sections=[	               
         {name:"name_dropdown", height:33, 
                         type:"select", options:names, map_to:"client_name", focus:true },         
	 {name:"phone_field", height: 20, map_to: "phone", type: "textarea"},
	 {name:"email_field", height: 20, map_to: "email", type: "textarea"},			                           
         {name:"time", height:72, type:"time", map_to:"start_time"}
 ];

scheduler.attachEvent("onEventAdded", function(event_id,event_object){
                  event_object.phone = "THIS IS A TEST";
                   event_object.email = "THIS IS A TEST"
		  scheduler.formSection('phone_field').setValue("THIS IS A TEST");
	          scheduler.formSection('email_field').setValue("THIS IS A TEST");
			    		
	          return true;
         	 });			         

This value gets written but not saved to the DB. :exclamation:

onEventAdded is too late, try to use onEventSave

Stanislav,

I have tried that as well but have the same issue. If i were to type into the field it would save with no problems or if I were to reopen the saved event then hit save again it seems to work. It doesn’t work any other way. What else could I try?

ANYONE??

Try to use

[code]scheduler.attachEvent(“onEventSave”, function(event_id,data){
data.phone = “THIS IS A TEST”;
data.email = “THIS IS A TEST”

return true;

}); [/code]

If you are using old version ( Scheduler 2.x or earlier ) you need to use a slightly different piece of code

[code]scheduler.attachEvent(“onEventSave”, function(event_id,data){
data = scheduler.getEvent(event_id);

data.phone = "THIS IS A TEST";
data.email = "THIS IS A TEST"

return true;

}); [/code]

THANKS A LOT THAT DID THE TRICK… :slight_smile: