Hi Saptarshi,

It's an well accepted pattern in data driven application (like ours),
> validation should be done ideally at the model layer... and when I raised
> the point of not doing it in JavaScript, I meant not doing that as default.
> By default doing the validation in model layer and then second for better
> UI, lesser server load and other benefits, doing the JavaScript
> validation...
>
> Doing it in web actions is somewhat doing it in the Controller, which is
> what I originally meant as a bad design, where chances are we can/have gone
> wrong.
>


I'm not sure about your point. Lets skip the javascript by pass things and
talk about normal user. For them, the javascript validator should be more
user friendly.  Actually, the purpose of the javascript validator beside
data security  is user friendly and less request to the server.
What a common javascript validator should do is :

   - Validate the data  after user finished entering value for one text
   field. Then show the error when user change focus to another text field. By
   this way, user can know they made a mistake right after they finished
   entering the value and change it at once.
   - Do not allow user to commit the form unless all the validation rule are
   passed.

By those things, we can reduce the number of time that user will submit the
form. And there should be many more advance methods that we can do.  Like
the user can not type a character into a number text field....etc..

I have fixed the validation bug from STQC in dhis india branch, just for the
maintanance module. Its still in progress but you can check out the latest
code , run the Add User form and see the result. I used the jquery validator
plugin. The only problem that i got is ... the language for the error
message... I have a file where I can defined all the error  messages in
different languages. But for that, I need the current language code...which
I could not find ...  Current, I have to ref the bean LocaleManager  and
then get the countryCode and languageCode from it....which I think..is not a
really good way. The code should be somewhere in the interceptor...

regards,
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to