Page 1 of 1

Multi-Language Field Error Mesage - Client Side Validation

Posted: Mon Mar 04, 2024 6:20 pm
by mehmetbkm

I have a field named "phone". I validate this field with "regural expression". I use two languages and write an error message in both languages in the "error message" property of this field. When verifying, I always get the "Incorrect field value" warning instead of the error message I created.


Re: Field Error Mesage

Posted: Mon Mar 04, 2024 11:02 pm
by arbei

After changing field phrases, make sure you have re-generated all the language files (under the "lang" folder) and re-uploaded them to your development/production server.


Re: Field Error Mesage

Posted: Mon Mar 04, 2024 11:32 pm
by mehmetbkm

I activated client-side (JavaScript) from the PHP settings in the general options. I used the following regular expression for the phone field: /\+90\d{10}$/ sample phone: +905051112233
then, I went to the "error message" field and set my own error message for two languages using the Multi-Language Property Editor. Do you need any other settings?


Re: Multi-Language Field Error Mesage

Posted: Mon Mar 04, 2024 11:47 pm
by mehmetbkm

i can see my own error messages in the lang folder in the project.en-US.xml file and project.tr-TR.xml . but it doesn't work

<field id="phone">
<phrase id="fldcaption" value="phone" />
<phrase id="flderrmsg" value="Sample Format: +905051112233" />
<phrase id="custommsg" value="Sample Format: +905051112233" />
</field>

<field id="phone">
<phrase id="fldcaption" value="Telefon" />
<phrase id="flderrmsg" value="Örnek Format: +905051112233" />
<phrase id="custommsg" value="Örnek Format: +905051112233" />
</field>


Re: Multi-Language Field Error Mesage - Client Side Validation

Posted: Tue Mar 05, 2024 10:52 am
by arbei

The client side validators does not use field error message, it uses the global "IncorrectXXX" phrases such as "IncorrectField" for regular expression. I think it should use the phrase "IncorrectRegExp" (i.e. "Regular expression not matched") which exists in the language file.


Re: Multi-Language Field Error Mesage - Client Side Validation

Posted: Wed Mar 06, 2024 10:15 am
by Webmaster

arbei wrote:

I think it should use the phrase "IncorrectRegExp" (i.e. "Regular expression not matched") which exists in the language file.

Try v2024.9.