← Back to team overview

dhis2-devs team mailing list archive

Re: [Bug 541788] [NEW] Testing for Date formatted text field validation working not well formed - Data entry

 

Hi,

After a short discussion with Hieu on another thread  in Vietnamese. I came
up with some thoughts :

*Use i18n.getString("..") for jquery validation error messages *

As you know, that method can not be called from a javascript file, it only
works with in-page javascript.

If you really want to do this, then I can create a .vm file which will have
a macro. This velocity macro will be used for calling all the i18n.getString
methods. Then in each page you need the jquery validation, you need to parse
that macro on the top of the page.

This is somehow complicated... I prefer to keep current approach.

*Validation rules depend on locale code*

As you know, I modified the jquery validation to get the messages base on
the  locale code .

For validation rules, I can also do the same.

For each rule like  dateISO, alphanumeric.. I would have different methods
for each language.

Those methods will be added to the arrays methods of jquery validation
plugin when you call the method

 jQuery.validator.loadLocaled( jQuery("#curLocaleCode").val() );.

Of course , all the rules that are generic like : maxlength , minlength ...
still be in the default array of methods.

*Disadvantage: *

Doing this means : for each language , we *must *provide the method which
has been already defined on the field. Or else, there should be error.

For example : if I defined the rule  alphanumeric for   user name field on
the form.  Then in Hindi language , even I don't know how to do it or  I
don't want that rule, I still have to define the method for that rule  in
Hindi without checking anything, just return TRUE ...

Another point is... for any new language that we use...someone has to touch
those things..... or at least tell me to do it...

Please give comment.

-- 
Viet Nguyen

References