dhtmlxform and custom edit

scheduler.form_blocks["my_editor"]={ render:function(sns){ return "<div class='dhx_cal_ltext' id='myForm' style='height:100px;'></div>"; }
then

formData = [ {type: "checkbox", label: "Загальний аналіз крові з лейкоцитарною формулою", name:"BLOOD", position: "label-right", checked: false, list:[ {type: "select", label: "форма №", name:"FormB", options:[ {text: "", selected: true}, {value: "224", text: "224/о "} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Визначення групи крові та резус-фактора", name:"rezus", position: "label-right", checked: false, list:[ {type: "select", label: "форма №", name:"FormR", options:[ {text: "", selected: true}, {value: "207", name: "F2207", text: "207/о "} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Коагулограма", name:"koalug", position: "label-right", checked: false, list:[ {type: "newcolumn"}, {type: "select", label: "форма №", name:"FormL", options:[ {text: "", selected: true}, {value: "237", text: "237/о "}, {value: "238", text: "238/о (спрощена)"} ]}, {type: "newcolumn"}, {type: "button", width:"15", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Аналіз крові на вміст цукру", name:"sugar", position: "label-right", checked: false, list:[ {type: "select", label: "форма №", name:"FormS", options:[ {text: "", selected: true}, {value: "231", text: "231/о "} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Аналіз крові на RW НВsАg та ВІЛ", name:"RW", position: "label-right", checked: false, list:[ {type: "select", label: "форма №", name:"FormRW", options:[ {text: "", selected: true}, {value: "241", text: "241/о "}, {value: "245", text: "245/о "}, {value: "246", text: "246/о "} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Загальний аналіз сечі", name:"sech", position: "label-right", checked: false, list:[ {type: "select", label: "форма №", name:"Formsec", options:[ {text: "", selected: true}, {value: "210", text: "210/о "} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Бактеріоскопічне та бактеріологічне дослідження піхвового вмісту, включаючи обстеження на БВ", name:"BV", position: "label-right", checked: false, list:[ {type: "select", label: "форма №", name:"FormBV", options:[ { text: "", selected: true}, {value: "BV", text: "BV"} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "УЗД", position: "label-right", name:"UZD", checked: false, list:[ {type: "select", label: "форма №", name:"FormUZD", options:[ {text: "", selected: true}, {value: "UZD", text: "УЗД"} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "ЕКГ", position: "label-right", name:"EKG", checked: false, list:[ {type: "select", label: "форма №", name:"FormEKG", options:[ {text: "", selected: true}, {value: "EKG", text: "ЕКГ"} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Екскреторна пієлографія", position: "label-right", name:"EP", checked: false, list:[ {type: "select", label: "форма №", name:"FormEP", options:[ {text: "", selected: true}, {value: "EP", text: "Екскреторна пієлографія"} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "checkbox", label: "Роздільне лікувально-діагностичне вишкрібання матки та церві кального каналу", position: "label-right", name:"MK", checked: false, list:[ {type: "select", label: "форма №", name:"FormMK", options:[ {text: "", selected: true}, {value: "RLD", text: "Роздільне лікувально-діагностичне"} ]}, {type: "newcolumn"}, {type: "button", value: "+"}, {type: "newcolumn"}, {type: "button", value: "Направление"} ]}, {type: "label", list: [ {type: "button", value: "Save", name:"save"}, {type: "newcolumn"}, {type: "button", value: "Load",name:"load"} ]} ]; myForm = new dhtmlXForm("myForm", formData);

all init but with error
TypeError: Result of expression ‘G.focus’ [undefined] is not an object.

and stuck with save, get data from form_blocks[“my_editor”] ???

or that can’t be done this way ???

Hello,

scheduler.form_blocks["my_editor"]={ ...
Please provide full code for your form block.

Best regards,
Ilya

[code]formData = [
{type: “checkbox”, label: “Загальний аналіз крові з лейкоцитарною формулою”, name:“BLOOD”, position: “label-right”, checked: false, list:[
{type: “select”, label: “форма №”, name:“FormB”, options:[
{text: “”, selected: true},
{value: “224”, text: "224/о "}
]},
{type: “newcolumn”},
{type: “button”, value: “+”},
{type: “newcolumn”},
{type: “button”, value: “Направление”}
]},
{type: “checkbox”, label: “Визначення групи крові та резус-фактора”, name:“rezus”, position: “label-right”, checked: false, list:[
{type: “select”, label: “форма №”, name:“FormR”, options:[
{text: “”, selected: true},
{value: “207”, name: “F2207”, text: "207/о "}
]},
{type: “newcolumn”},
{type: “button”, value: “+”},
{type: “newcolumn”},
{type: “button”, value: “Направление”}
]}
];

	scheduler.config.xml_date="%Y-%m-%d %H:%i";
	scheduler.config.details_on_dblclick=true;
	scheduler.init('scheduler_here',null,"week");
		
	scheduler.form_blocks["my_editor"]={
		render:function(sns){
			return "<div class='dhx_cal_ltext' id='myForm' style='height:400px;'></div>";
			
		},
		set_value:function(ev){
			ev.details = new dhtmlXForm("myForm", formData);
		},
		focus:function(node){
			
		}

		}
	scheduler.config.lightbox.sections=[	
		{ name:"description", height:300, map_to:"text", type:"my_editor" , focus:true},
		{ name:"time", height:72, type:"time", map_to:"auto"}	
	]
	
}[/code]

dhtmlxform and dhtmlxscheduler can exist together ???
can i init form data to div object in scheduler.form_blocks[“my_editor”]={} …
and save, load setting from “myForm” to xml data in database ???

Hello,

Check the following small sample:

[code] var formData = [
{type: “select”, name: “audioquality”, label: “Select Audio Quality”, options:[
{value: “1”, text: “2.0 16bit/128kbps”},
{value: “2”, text: “2.1 16bit/334kbps”},
{value: “3”, text: “5.1 32bit/448kbps”, selected: true}
]},
{type: “select”, name: “videoquality”, label: “Select Video Quality”, options:[
{value: “1”, text: “DVD MPEG-2”, selected: true},
{value: “2”, text: “DivX”},
{value: “3”, text: “XviD”}
]},
{type: “input”, name: “comments”, label: “Comments”, value: “Some Comments”, rows: 3},
{type: “button”, name: “btn2”, value: “Submit”, command: “reset”}
];

    scheduler.locale.labels.section_custom="Form";

    scheduler.form_blocks["form"] = {
        render:function(sns) {
            return "<div id='test' style='height: "+sns.height+"px'></div>";
        },
        set_value:function(node,value,ev,config){
            var form = new dhtmlXForm(node, formData);
        },
        get_value:function(node,ev,config){
            // custom logic here
        },
        focus:function(node) {
        }
    };

    scheduler.config.lightbox.sections=[
		{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
		{name:"custom", height:200, type:"form", map_to:"section_id" },
		{name:"time", height:72, type:"time", map_to:"auto"}
	];      [/code]

And screenshot in the attachment.

Best regards,
Ilya

great, thanks, probably something mist ;(

and have some problem with button in section header ;(

in sample work, but not in my code no ;(

discover that dhtmlxscheduler.js file is greater then in official release …

and how to catch up multiple button’s on section

i want one to show

[code]scheduler.form_blocks.textarea.button_click = function(index,el, section, cont){
if (!cont.open && !cont.blocked){
cont.style.height=“115px”;
el.style.backgroundPosition="-5px 0px";
el.nextSibling.innerHTML = scheduler.locale.labels.button_recurring_open;
} else {
cont.style.height=“0px”;
el.style.backgroundPosition="-5px 20px";
el.nextSibling.innerHTML = scheduler.locale.labels.button_recurring;
}
cont.open=!cont.open;

	scheduler.setLightboxSize();
};[/code]

and other is to create window or something else …

when click on existing ligth box, form init again and in field form now i habe 2 form ;( how to destroy or clear that already exists ???

at section only exist one button ?? or it can be more than one ???

first event

second event

strange ???

why lightbox is not unique for event ???

it always same like init first time, now i see why it duplicate dhtmlxform !!!

if div objects is always standard for all lightbox no way to change it dynamically ;( sad …

Hello,

Our function to create button allows only one button. But you are free in set_value for that section to locate header div element and append anything you like (two buttons, for example).

It seems I haven’t included check if form was initialized —> no need to init it again, you can add it so form won’t appear second time. Or you remove section content every time and init everything again.

It was designed that way. There is only one lightbox form but it can be completely custom for each and every event (you can control what will be displayed using onBeforeLightbox event and set_value function of every section.

Best regards,
Ilya

scheduler.form_blocks.button.set_value ???
example be great and thanks for help …

thanks :slight_smile: