Hide form buttons dynamically

Hi,

thank you for this nice framework. One question:

I have a form in a window:

dhx.ui({
		view:"window",
		head: false,
		width:1010,
		height: 50,
		top: 700,
		left: 5,
			
		body:{
			rows:[
			{ view:'form', id:'myForm', data:[
				{ type: 'form_button', id: 'button_ok', value: 'OK', width: 190, click: 'show' },
{...}
				]
			}
			]
		}
	});

Now I want to hide the button at start up and show it when the user trigger an event (button click, text field: input text complete,…)

  • How can I hide a form control?
  • How can I show a form control dynamically?

I tried to access the control with $$(‘myForm’). But then I don´t know how to get the id ‘button_ok’…

Thank you

There is no “hide” attribute, but you can

a) remove|add buttons on the fly

$$('myForm').remove('button_ok'); //later $$('myForm').add({ type: 'form_button', id: 'button_ok', value: 'OK', width: 190, click: 'show' });
or

b) maybe not very logical, but you can use filter method ( yep, all collection based controls supports filtering )

[code]
//hide button
$$(‘myForm’).filter(function(obj){
return obj.id != “button_ok”
});

//show button
$$(‘myForm’).filter();[/code]