Server side validation


#1

I am trying to move from version 5 to 7 but it is pain in the ass as the documentation is poor for new versions and lots of functionalities are missing.
So quick question:
I have a form which I send to server. Validation on client side is done, but server responses that one of the fields has, for example, duplicated value. How to set the field as not validated and add errorMessage to it?


#2

Hello, klysiak!

This demo helped me a lot. The interaction between the form and the backend is there, too.


#3

Hi Labirintami,

Please enlight me and tell me where there is any interaction between form and server side except sending form to server in the example?
All fields validation is done only on client side…

This does not answer my question.


#5

send() method returns the Promise object:
https://docs.dhtmlx.com/suite/form__api__form_send_method.html
so you may try to catch the “rejected” form request, and inform the user about the probable fail reason.
Unfortunaetly it is not aivlabale to indicate the form control as “validation fail” without actual (client-side only) validation failing, so I can suggest you to clear(modify) the input value and inform the user about the “error” using the dhtmlxPopUp or the dhtmlxMessage.