Support disabled property when calling setProperties in suite Form

In Form is very common enable/disable a button dynamically. But the method setProperties don’t support this property.

Given a form called tools, would be great do something like:

this.tools.setProperties("my_button", {disabled: some_variable});

We can use getItem and disable() or enable(), but the path of setProperties es less verbose.

And this will works, but is more error prone.

this.tools.getItem("my_button")[some_var ? 'disable' : 'enable']();

Just curious - why would

this.tools.getItem("my_button").disable();

be more error prone and longer?

More error prone… really not, but your your example:

this.tools.getItem("my_button").disable();

Works when you know that the next state is disabled. But the setProperties allow change the state directly from a variable without if or ternary operator.

Some times you will need to do:

if(some_var){
     this.tools.getItem("my_button").disable();
}else{
      this.tools.getItem("my_button").enable();
}

With setProperties:

this.tools.setProperties("my_button", {disabled: some_variable});

Furthermore, setProperties supports the simultaneous setting of multiple attributes.

There is a isDisabled() method:

allowing to get if the control is disabled

Thanks @sematik, but what I wish is to set the disabled property with the setProperties method. But this is not implemented, disabled is not included in the properties that are affected by setProperties. I guess because setProperties accept an IFormProps not an IFormConfig.