Why can't you add a EditorExit Handler to a DynamicForm or FormItem?
Asked Answered
G

2

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.

Gerda answered 29/3, 2012 at 10:42 Comment(1)
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.Rennie
G
0

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

Gerda answered 31/7, 2012 at 10:21 Comment(0)
A
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);
Arabesque answered 30/3, 2012 at 8:19 Comment(2)
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"Gerda
Guys stop voting for this answer. Because it does not answer the question! Even the answerer admited thatGerda
G
0

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

Gerda answered 31/7, 2012 at 10:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.