Question

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.

Was it helpful?

Solution 2

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

OTHER TIPS

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top