dhtmlx.modalbox example


#1

Can someone provide an example of a Modal box returning input field values. The documentation states…

function returns the html container of the box which can be used for some actions

	var box = dhtmlx.modalbox(...);
	box.getElementsByTagName("input")[0].focus();
	...
	dhtmlx.modalbox.hide(box); //hide popup 

But I don’t know how it can be done.

Please help with an example.

Thanks


#2

You can use something like next

	var box = dhtmlx.modalbox({ 
		title:"Configuration", 
		text:"<div id='form_in_box'><div><label> Input width <input class='inform' type='text'></label></div><div><label> Input height <input class='inform' type='text'></label></div><div><label> Input details <textarea class='inform'></textarea></label></div><div><span class='dhtmlx_button'><input type='button' value='save' onclick='save_callback()' style='width:250px;'></span></label></div></div>",
		width:"300px"
	});
	function save_callback(){
		var inputs = box.getElementsByTagName("input")
		alert(inputs[0].value);
		
		dhtmlx.modalbox.hide(box);
	}

#3

I have tried this approach. It no longer works because everything in the window is readonly including the input created with the text: parameter.


#4

Sorry I’m wrong… was using a dhtmlx.confirm and trying to use the text: to get input. Your example shows modalbox.


#5

dhtmlx.confirm blocks all keyboard actions ( to ensure the dialog modality )
If you want to have a custom input - use dhtmlx.modalbox instead.