client side validation for unique recorn in database

client side validation for unique recorn in database

hanyelbanahanyelbana Posts: 24Questions: 0Answers: 0
edited August 2013 in Editor
Hi,
Some records in my database is unique, in Editor when user add duplicate date he get this error "An error has occurred - Please contact the system administrator".
Is there any method to display JSON error which returned from the server as friendly error for the user?

and How to translate this error?

Thanks

Replies

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin
    > "An error has occurred - Please contact the system administrator"

    That can't be translated as the user should never see that error.

    What I think you want to do is use server-side validation and reject the field if it found to be a duplicate. If it is, then you can return a string which will be shown as the error message - so you can translate the error message there. If you look at this page http://editor.datatables.net/server/ , the section "Add new record with a field error" shows how to return a server-side error for a field: Add new record with a field error

    Allan
This discussion has been closed.