ChronoForms validation

cox 18 Aug, 2008
Hi to all.
I am interested in the following question:

May I add checks in Cyrillic (ukrainian and russian) ChronoForms validation for Alphabetic and Alphanumeric?

If possible, how exactly do this?
Ps: if this issue is at the forum, I have not found him.

Thanks.
GreyHead 18 Aug, 2008
Hi cox,

You'll need to modify the regular expressions in the validation.js (for Prototype) or Moovalidation.js files. in validation.js the code is around line 238 and the alpha regex is /^[a-zA-Z]+$/

Bob
T34 16 Oct, 2010

You'll need to modify the regular expressions in the validation.js (for Prototype) or Moovalidation.js files. in validation.js the code is around line 238 and the alpha regex is /^[a-zA-Z]+$/



I have change the Moovalidation.js file according your suggestion, but when I switch on the validation-alpa option for the field in "Validation" menu, switch "Validation Library" to "mootools" and write the field id "name" in the "4- validate-alpha (letters only)" string, I see like it works using... the latin symbols validation. 😲

Where is my mistake?
GreyHead 17 Oct, 2010
Hi T34,

The pattern there does only match basic Latin characters. You can replace it with a different expression to match your requirements.

I did a little exploration and came up with [\p{Lu}\p{Ll}\p{Nd}]+ as an alternative that should match any Unicode alpha-numeric characters - though this may be too broad for you.

Bob
T34 18 Oct, 2010
Hi Bob!

[quote="GreyHead"]

I did a little exploration and came up with [\p{Lu}\p{Ll}\p{Nd}]+ as an alternative that should match any Unicode alpha-numeric characters - though this may be too broad for you.[/quote]

Thanks for reply.

I have try to replace with [color=#000080][\p{Lu}\p{Ll}\p{Nd}]+[/color], but when I use the Cyrillic symbols in the form field — I see the error message anyway. Where is my mistake? The form page is here.

And is any way to exclude numbers from the modified js-code? I need to use validation for the field "name" and I shouldn't like to see the names like 1212341234blabla in the database. 😀
GreyHead 18 Oct, 2010
Hi T34,

Sorry - you need to find a regular expression that does what you need. Not a service that I can sensibly offer.

Bob
T34 18 Oct, 2010
Hi Bob!

I have find one of mootools extras here. What's your opinion: is a reason to try find a solution using this one? I'm not a coder, but psychologist only🤣 May be is a way to implant this extra to CF?
GreyHead 23 Oct, 2010
Hi T34,

I don't think that the MooTools link does what you want. You need a Regular Expression from somewhere like RegExLib.com or RegexMagic.com to identify the set of characters that you want to validate.

Bob

PS Maybe in some Vygotskian sense new concepts are appearing in your Zone of Proximal Development.
T34 24 Oct, 2010
Thanks a lot Bob!

I have find a solution here and here.

For use validation in russian I need to put /^[а-яА-ЯЁё\s]{3,32}$/ instead /^[a-zA-Z]+$/ and save the file in UTF-8 charset.

There is a question: I select the mootools Validation Library in the form's settings (Validation). But the validation function of the form uses not mooValidation.js but jsvalidation2.js file. What is difference in usage one of them? And how to switch?

P.S. Do you read Vygotskiy? 😀
GreyHead 25 Oct, 2010
Hi T34,

Please see this post for adding a custom validation or this thread for hacking the validation files.

Bob

PS I've read about Vygotskiy's work - but only some extracts from his writings. (I do have a few Luria books on the shelf here though).
01 14 Oct, 2012
Hi!
Which files I must change in version 4?
The validation and Moovalidation is absent.
Thank you!
01 14 Oct, 2012
Thank you for prompt reply!
I'll check it now
01 14 Oct, 2012
Hi!
Strange, but nothing works... Already tried several variations with regex... but no luck.
As I understand it doesn't check string at all. So... it's something wrong with config?
I've change validation to JS, but for test purpose also turned it off.
Attaching my config.
Thank you!
GreyHead 14 Oct, 2012
Hi 01,

Please see this FAQ you have not added the Event Loop action to reload the form on an error.

Bob
01 14 Oct, 2012
Hi!
Thank, yes it's my mistake. I've added event loop, but still no luck.
Have I configured it exactly?
In Event Loop (28) I haven't made any chagnes. The Target Event it set to OnLoad
GreyHead 14 Oct, 2012
Hi 01,

That looks OK from here.

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
01 14 Oct, 2012
Ok!
Thank you!
GreyHead 14 Oct, 2012
Hi 01,

From a quick check it appears to be working OK. This is accepted 'dgdgdgФам' and this is rejected 'dgdgdg::Фам'

What exactly isn't working?

Bob
01 14 Oct, 2012
Hi!
Very strange... I also now trying to enter "dgdgdgФам", but I receive
"This field accepts alphabetic characters only." error😟
01 15 Oct, 2012
Solved!
Hah, I forgot to uncheck standard alphanum validation checkbox from form wizard... So it's caused the problem...
And regex should be tweaked a bit.
This topic is locked and no more replies can be posted.