popup field

Hello,
I have created a dialog with text fields in it.

my class extends the DialogWrapper class.

my question is how can I make the Text Fields mandotory?

any help would be appriciated.

2 comments
Comment actions Permalink

You can take a look at DialogWrapper.setErrorText()

You can override DialogWrapper.doOKAction() to smth like this:

@Override
protected void doOKAction() {
  if (isDataValid()) {
    super.doOKAction();
  } else {
    setErrorText("Text field is mandatory");
  }
}


Also, this check can be performed in TextField listener with DialogWrapper.setOKActionEnabled().

0
Comment actions Permalink

Also, if the dialog is simple, you might look at Messages.showInputDialog() and InputValidator / InputValidatorEx.

0

Please sign in to leave a comment.