mobile scheduler editForm selected options

I lack a basic understanding on how options controls on the editForm are selected on an Edit Event.

How does the combo value get set to selected when editing an event in the scheduler?

Is it suppose to be set by the Object of the selected event?

I have code below where I believe that I am suppose to set my custom field to the options field value, but I don’t know how to use dhtmlx scheduler code to set the selected value.

The first portion of code is the scheduler.config.form where i set the values of each of the options controls.

The second set of code is the $$(“scheduler”).$$(“views”).attachEvent(“onViewChange” code where i attempt to set the selected value for the combo box for each of the custom fields (services, clients, staffs)

	scheduler.config.form = [
				             			{view:"combo",		label:"Client",	map_to:'client',id:'client',name:'client' ,options:
<c:forEach var="client" items="${clients}" varStatus="theCount">
<c:if test="${not empty client.key}">{ id:"<c:out value='${client.key}' />", value:"<c:out value='${client.value}' />" }<c:if test="${not theCount.last }">,</c:if></c:if>
				             			{view:"combo",		label:"Service",	map_to:'text',name:'text' ,options:[
<c:forEach var="service" items="${services}" varStatus="theCount">
<c:if test="${not empty service.key}">{ id:"<c:out value='${service.key}' />", value:"<c:out value='${service.value}' />" }<c:if test="${not theCount.last }">,</c:if></c:if>

                          				{view:"combo",		label:"Staff",	map_to:'staff',id:'staff',name:'staff' ,options:[
<c:forEach var="staff" items="${staffs}" varStatus="theCount">
<c:if test="${not empty staff.key}">{ id:"<c:out value='${staff.key}' />", value:"<c:out value='${staff.value}' />" }<c:if test="${not theCount.last }">,</c:if></c:if>

				             			{view:"datepicker",	label:"Start",	id:'start_date', name:'start_date',	timeSelect:1, dateFormat:"%m/%d/%Y %h:%i %a"},
				             			{view:"datepicker",	label:"End",	id:'end_date', name:'end_date',	timeSelect:1, dateFormat:"%m/%d/%Y %h:%i %a"},
				             			{view:"datepicker",	type:'hidden',label:"Date",	id:'apptdate', name:'apptdate',	timeSelect:1, dateFormat:"%m/%d/%Y %h:%i %a"},
				             			//custom section in form
				             			//button can be removed
         			{view:"button", label:"Checkout", name:"checkout", id:"checkout"}
   if($$("scheduler").innerId(view2) == "form"){
			if($$("scheduler").$$("editForm").elements["start_date"] != 'undefined' && $$("scheduler").$$("editForm").elements["start_date"].getValue() != 'undefined'){
				console.log("start_date is what? "+$$("scheduler").$$("editForm").elements["start_date"].getValue());
				// how to set the options list to a selected value?

   return true;

Here is how you can default values: … event_data

This is for the case when you add a new event.

If you are editing existent event, the form is populated with values of this event. So, the event should contain all necessary properties.

Thank you for the reply.

I have properties in my Object that matches the “editForm” or “form”.

However, the fields in the “form” that are options are not being “selected” for values for said fields of Object. This is why I thought I might need to select the options field in the “form” myself.

The problem was that i had the mapping incorrect. So, I got it working now by making sure that the options id and name were being properly mapped to my custom object fields

Thanks for the help