This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

text field languages
#1

hi steven,

i need to allow other language name in the text field(username) while user adding comment.

Currently it shows "The name can only contain letters, numbers and ' & . -".

What should i do ?
Reply
#2

You need to edit the regular expression in the code below:

PHP Code:
<?php 
/*
* Checks if the name contains only valid characters
* Letters, ampersand, hyphen, apostrophe, period, space, numbers
* \p{L} (any kind of letter from any language)
*/
public function isNameValid($name) {
if (
preg_match('/^[\p{L}&\-\'. 0-9]+$/u', $name)) {
return
true;
} else {
return
false;
}
}

/upload/frontend/model/main/form.php

Have you completed the interview?
Reply
#3

Hi Steven.

THank you so much for your reply.

I edited the code to include "malayalam" language: from kerala, india

changed the code as below:

if (preg_match('/^[\p{Malayalam}&\-\'. 0-9]+$/u', $name)) {
return true;
} else {
return false;
}
And working properly. now i can add malayalam keywords in name field.

Thank you so much
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
14-Aug-2020, 08:22 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)