Fill Value per Deefault in text field

Hello, I need to create a calendar event the template field is populated by default with a value I provide in the select.

I did as below, however when creating the event the text field is blank, but to create the same event, the second time it works correctly. Ie, only the second time I take 2 clicks on the screen fills the ‘Template’ field.
I save the value in a text imput the type, then retrieve it and pass the text of the calendar.

Could help me for this value to be filled in by default in the first creation of the calendar event?

$.get(“Scripts/dhtmlxScheduler/XMLDadosCliente.aspx?idEvento=” + idEvento, function (data) {
document.getElementById(‘dadosCliente’).value = data.toString();
}, ‘text’);

                    var dados = document.getElementById('dadosCliente').value;
                    scheduler.getEvent(id).text = dados;

Field declaration:

{ name: “description”, height: 50, map_to: “text”, type: “template”, disabled: true },

In Annex 2 accompanying images.

Thanks a lot.

what triggers this code?var dados = document.getElementById('dadosCliente').value; scheduler.getEvent(id).text = dados;if you want this value to be applied to new events, try something like followingscheduler.attachEvent("onEventCreated", function(id,e){ var dados = document.getElementById('dadosCliente').value; var ev = scheduler.getEvent(id); ev.text = dados; return true; }); … event.html


It’s just like in your example I made my code.
The problem is that it takes effect only the second time I click to create a new schedule. The first time I click the event is empty.

I have the impression that the event is being called after the opening of the calendar event, and why it’s not working properly.

Is there another way that I can use to do this then?


Resolved. Identified the error: the code was storing data in “text imput” I used to store the data to be inserted into the schedule when the “onEventCreated” event was called, so was not working properly.

Changed to fill the opening page, and recover in the event called “onEventCreated”.

Thank you. :smiley: