Prevent entry of text in foreign characters

General questions regarding the use of languages in Joomla! 3.x.

Moderators: infograf768, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
User avatar
lausianne
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 154
Joined: Thu Apr 06, 2006 3:15 pm

Prevent entry of text in foreign characters

Post by lausianne » Thu Aug 02, 2018 9:29 am

Hello,

Usually we are concerned about enabling use of various languages with Joomla. Now I had, for the first time, a request from a client to disable the use of foreign languages on his site. The problem is that someone placed an order in his Virtuemart shop and wrote everything in Chinese.
The client now asks me to limit the characters to be used in form fields to latin characters.

Do you have an idea how to achieve that with reasonable effort?

My first idea is to write something up in Javascript, to check text in form fields for characters outside a set of characters (RegEx). Maybe this or something similar/better already exists?

Thank you!


EDIT: googled further and came across this, seems simple enough:
https://www.w3schools.com/tags/att_form ... harset.asp
EDIT: Added this in RSForm, makes no difference -> fail

SharkyKZ
Joomla! Ace
Joomla! Ace
Posts: 1172
Joined: Fri Jul 05, 2013 10:35 am
Location: Unknown

Re: Prevent entry of text in foreign characters

Post by SharkyKZ » Thu Aug 02, 2018 10:29 am

Regex is fine. If Form API is used for the form, create a form rule. See core form rules for example https://github.com/joomla/joomla-cms/tr ... /Form/Rule.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18663
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Prevent entry of text in foreign characters

Post by infograf768 » Thu Aug 02, 2018 12:00 pm

Not sure using only accept-charset="ISO-8859-1" will work.
As Joomla is using utf8, ISO-8859-1 may not display correctly for accented or other special letters like ç.
One may have to reconvert these to utf8 by using `utf8_encode`
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group


Post Reply

Return to “Language - Joomla! 3.x”