1

I have created a custom widget with configuration in web appbuilder. What I need to do is disable "Ok" button or do nothing if all fields in the config screen are not filled. In other words, I need to do save only when all inputs are filled. Any idea how to achieve it?

Regards, Jamil

  • No reply??? No body did such implementation in Web AppBuilder???? – Jamil Nov 13 '15 at 5:50
1

I'll provide my solution, even though this is an old post, since it's a top Google result.

As far as I know, you cannot disable the OK button, but there is a way to prevent users from moving forward if they don't meet your validation test.

When you click OK on the widget settings page, the getConfig() method is fired. If we return false on this method, the user will not be able to close the settings page. Therefore, we can add a validation method and return false if some criteria is not met - with a popup indicating what the user omitted.

getConfig: function() {
  if ( !this.yourValidationMethod ) { 
    return false
  }
},

yourValidationMethod: function() {
  if (lang.trim(this.someInput.get('value')) === '') {
    return false;
  } else { 
    return true 
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.