Forums

UTF-8 characters in Livevalidation not working

Attros 16 Dec, 2009
Hello!
I'm using Joomla in Hungarian language. For this reason I need to use the validation rules in Hungarian, with Hungarian characters. But the validation isn't working with such characters. I can use only the "required" validation but not the "only alpha" validation (I mean only letters)or the combination of these.
So I can not use the more restricted validation on fields like Name, Prename, Surname, etc. The specific hungarian characters like áÁéÉíÍóÓöÖőŐúÚüÜűŰ are not recognized at all, making the Livevalidation to show the error message.
I use UTF-8 encoding on the page and in the SQL database. I've put the necessary code in the htaccess to force the utf-8 encoding (I had read in some topic) but not helped.
I can't to find any topic related to this after hours of searching and reading.
Please help me to resolve this issue or point me to the right topic.
I'm using latest Joomla and CF.
Thank you in advance,
Attila
GreyHead 16 Dec, 2009
Hi Atilla,

That's correct, the alpha validation checks for [a-z][A-Z] only.

If I remember correctly there is at least one other thread here describing how to validate different alphabets and a couple on adding custom LiveValidations here's one

Bob
slinep 24 Dec, 2009
Hi Attila,

i had the same problem too - Czech language. The solution is very easy. There is jsvalidation2.js file (components/com_chronocontact/js/jsvalidation2.js), just find which validation you need to change and write inside letters you need to be accepted - look down, letters are bold.

Michael


if(field.hasClass('validate-alpha')){
if( tmessage) { var message_validate_alpha = tmessage; }
name.add( Validate.Format, {
pattern: /^[ěščřžýáíéóúůĚŠČŘŽÝÁÍÉÓÚŮa-zA-Z ]+$/,
failureMessage: message_validate_alpha
});
fieldsarray[fieldsarray_count] = name;
fieldsarray_count = fieldsarray_count + 1;
}
vdolerud 09 Feb, 2010
Hi!

I have the same problem with Norwegian characters.
I edited the jsvalidation2.js to look like this:
if(field.hasClass('validate-alpha')){
if( tmessage) { var message_validate_alpha = tmessage; }
name.add( Validate.Format, {
pattern: /^[æøåÆØÅa-zA-Z ]+$/,
failureMessage: message_validate_alpha
});
fieldsarray[fieldsarray_count] = name;
fieldsarray_count = fieldsarray_count + 1;
}

But if I use one of the characters in a field, I get an error message saying that the field is not filled out.

Is there anything I've missed?

--
Vegard
sunshineh 21 Jun, 2011
Hi,
I have the same problem and added/changed the following lines:
			if(field.hasClass('validate-alpha')){
				if( tmessage) { var message_validate_alpha = tmessage; }
				name.add( Validate.Format, { 
					pattern: /^[üöäßÜÖÄa-zA-Z ]+$/, 
					failureMessage: message_validate_alpha 
				});

				fieldsarray[fieldsarray_count] = name;
				fieldsarray_count = fieldsarray_count + 1;
			}

			if(field.hasClass('validate-alphanum')){
				if( tmessage) { var message_validate_alphanum = tmessage; }
				name.add( Validate.Format, { 
					pattern: /^[üöäßÜÖÄ0-9a-zA-Z ]+$/, 
					failureMessage: message_validate_alphanum 
				});

				fieldsarray[fieldsarray_count] = name;
				fieldsarray_count = fieldsarray_count + 1;

			}


But I am always getting the following messages:
Please use letters only (a-z) or numbers (0-9) in this field.

Can you help me?! What else should I do?
This topic is locked and no more replies can be posted.