Reading form values in "details Form"

Hi,

I am trying to customize the “details Form” in the mobile scheduler. I added an extra button and a handler function as follows:


var abrirQuestionarioFn = function() {
    // TODO Read form values and set parameters below
    // myFunction(...);
};

scheduler.config.form = [
	{view:"combo", label: 'Analista', name:'analista', id: "edit_analista", options: LISTA_ANALISTA_REL},
	{view:"combo", label: 'Medico', name:'medico', id: "edit_medico", options: LISTA_MEDICO},
	{view:"combo", label: 'Situacao', name:'situacao', id: "edit_situacao", options: LISTA_SITUACAO},
	{view:"datepicker",	label:"Inicio",	name:'start_date', id: "edit_start_date",	timeSelect:1, dateFormat:dhx.i18n.fullDateFormat},
	{view:"datepicker",	label:"Fim",	name:'end_date', id: "edit_end_date",	timeSelect:1, dateFormat:dhx.i18n.fullDateFormat},
	//buttons can be removed
	{view:"button", label:"Cancelar Evento", name:"delete", id:"delete", color: 'green'},
	{view:"button", label:"Questionario", name:"survey", id:"survey", click: abrirQuestionarioFn}
];

What I want to accomplish here is to read the values in the form in order to set the parameters of a function. Is this possible? How should it be done?

I also will need to hide/show this new button just like the “Delete” button in the details form as in “samples/07_mobile/06_custom_form.html”.

Thanks for all help.

— Andre

Hi,

to hide/show any view you may use hide() or show() method. For example to hide “survey” button you need to call the following:

$$(“scheduler”).$$(“survey”).hide();

The form values can be got by getValues() method that returns hash of form values:

var values = $$(“scheduler”).$$(“editForm”).getValues();

After data are saved, they are available as scheduler data:

var data = $$(“scheduler”).item(itemId);

Thanks, Alexandra. I was able to do what I wanted to.

Cheers,

—Andre

Andrecs, vê se vc pode me ajudar …

Estou usando a scheduler como timeline para uso de agenda de consultorio dentario.
Estou querendo apresentar os horários de cada dentista por consultorio. Ou seja, seleciono um consultorio num e após apresento no scheduler, somente os horários associados ao consultorio.
Preciso saber como passo esse parametro para a query de ‘select’ inicial ( Ex: ?id_consultorio=$id_consultorio ).

Se puder dar uma força, agradeço !!!