Question

Is there a way to integrate server side validation into the validation manager?

Following scenario:

  1. A form which has a validation manager (qx.ui.form.validation.Manager)
  2. When the user clicks on the submit button, the validation manager validates the form
  3. If the form is valid, the data gets submitted to the server (REST / JSON)
  4. The server now also validates the data, and generate an validation error for a field (JSON answer)
  5. Now the question: Is there a way to integrate this response into the qx validation manager?

The problem is, we have a lot of large forms connected to rest interfaces, and this interfaces validate the input and generate errors. We don't want to validate each single field to a remote interface, this is too much effort.

Our current solution is to display a message box, but this is not so user friendly, because the user has to search for the field, it's not marked as faulty.

Was it helpful?

Solution 2

Based on the answer [3] from Martin Wittemann, we have created our own async validator [1] which is working for us, but it's a little hack. You can use the class like the normal AsyncValidator [2].

OTHER TIPS

You can add a async validator [1] to the form itself [2]. In that async validator, you can send the request for the form. But the async validator is triggered as soon as you start the validation and does not consider the valid state of all sync validation functions. If you want to have that, you need to do that yourself. Maybe its as simple as a timeout and a check for the valid property of the form items.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top