7

This handler only exist for a ListGrid.

But if you look at the docs for DynamicForm.setValidateOnExit(), it says:

If true, form items will be validated when each item's "editorExit" handler is fired as well as when the entire form is submitted or validated.

Note that this property can also be set at the item level to enable finer granularity validation in response to user interaction - if true at either level, validation will occur on editorExit.

So how can we add a EditorExitHandler to a DynamicForm or a FormItem?

EDIT :

I want to create an error panel below the form to show all errors dynamically. Each FormITem has the possibility to validate on Exit but I do not know how to capture this validation event to check if the error panel should be updated or not.

Adel Boutros
  • 10,205
  • 7
  • 55
  • 89
  • Maybe you should describe to us what you are trying to achieve and we can discuss how this can be supported with what it is already available on the smartGWT's API. And just for semantics - but, still no EditorExitHandler exists - the "editoExit" refers to the FormItems and not to the DynamicForm and it is quoted. – gpapaz Mar 29 '12 at 21:47

2 Answers2

2

There is one method form.getErrors() and form.showError(true). By this you can acheive that. But for that also you need to setValidator for each field.

TextItem name = new TextItem("name", "Name");
name.setRequired(true);
name.setRequiredMessage("Please specify name of the Table");

NTRegExpValidator nameValidator = new NTRegExpValidator("(^[a-zA-Z0-9][\\w\\s.()_-]+)$","It should start with alphabets and can have alphanumeric values ( )_-. and space.");

name.setValidators(nameValidator);
name.addKeyUpFieldHandler(new KeyUpHandler){
    form.getErrors();
    form.showErrror(true);
});

DynamicForm form = new DynamicForm();
form.setField(name);
Tim Post
  • 33,371
  • 15
  • 110
  • 174
PVR
  • 2,534
  • 18
  • 38
  • I don't want to show the errors as is. I want to display them in a panel I created. Plus, there is no need for the KeyUpFieldHAndler as there is already a function to validate on change which I do not want to use because it is buggy. I just want to capture the event that says "hey, I am been validated" – Adel Boutros Mar 30 '12 at 08:22
  • 1
    Guys stop voting for this answer. Because it does not answer the question! Even the answerer admited that – Adel Boutros May 16 '12 at 21:40
0

After some research, I still don't find a convincing answer. I guess it must a dev requirement

Adel Boutros
  • 10,205
  • 7
  • 55
  • 89