views:

28

answers:

1

Hi, all.

In most web projects, we do both client-side and server-side form validation.

A major part of form validation is error prompt,

the client-side and server-side form validation library probably have implemented this for us,

but the error prompt looks different.

How can I design a consistent error prompt for such a system?

Thanks in advance.

A: 

The server-side validation should not be concerning itself with presenting errors to the user. It should simply return messages with details relevant to the hurled exception. The client-side exception handler should intercepted these messages, interpret them if necsseary and display the message to the user.

Well, that's the general principle. If you want specific advice you will need to edit your question to more details regarding your architecture.

APC
Thx. I'm just wondering how to make the error messages look the same, no matter the error is detected by the client side Javascript or server side program. And when the form validation fails in the server side, that may be because the user turns off Javascript of her browser, and the way you suggest won't work in this case.
Satoru.Logic