Forums

Change validation number from dot to comma

renas 08 Mar, 2012
Is it possible to change the validation.

I'm using Chronoforms v4.

Tks in advance
Max_admin 15 Mar, 2012
Hi,

Sorry but I can't understand your question ?

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
GreyHead 16 Mar, 2012
Hi renas,

The 'number' validation is included in the formcheck-ui.js file - you could change this but when you upgrade ChronoForms it will be over written. It's probably better to add a custom validation.

The Regular expression used is /^[-+]?\d*\.?\d+$/ To allow either a stop or a comma you could change this to /^[-+]?\d*[\.,]?\d+$/

Bob
renas 01 Oct, 2012
Hi GreyHead,

Is this valid for the last version?
The file is "formcheck-yui.js"?

I am trying this number above and the message pops up every time for a number validation.
122.353,03

Tks,

Renas
GreyHead 01 Oct, 2012
Hi Renas,

Yes, that's the file as fa as I an see, and it's this code number:/^[-+]?\d*\.?\d+$/,email: you'd need to edit.

Please see this FAQ too.

Bob
GreyHead 01 Oct, 2012
Hi Renas,

I tried the form in FireFox and IE and didn't get any errors.

Bob
renas 01 Oct, 2012
Hi GreyHead,

That's what i have made.
1. Go to Spread and just change from 0,5 to 0,54
2. Selected another box
3. Invalid number appeared

Tks,

Renas
GreyHead 01 Oct, 2012
Hi Renas,

The Regex requires both . & , please try /^[-+]?\d*[.,]?\d+$/

Bob
renas 01 Oct, 2012
Hi Greyhead,

As i can see this is expecting one of them.
In some cases they exist both as this:

100.555,2

The "." separates thousand
The "," separates decimal

Tks,

Renas
GreyHead 01 Oct, 2012
Hi Renas,

I think that the previous version required 999,.99 which probably isn't normal

Bob
renas 01 Oct, 2012
Hi Greyhead,

Is not.
Now works with "," or "." but not both.
Is possible to put something like this?

100.555,2

This can be ignored. But can be tricky.
Do you think this is possible?

Tks,

Renas
renas 01 Oct, 2012
Hi GreyHead,

I have changed to this one.
Now spread always get error with a comma only.😟

Many Tks,

Renas
renas 01 Oct, 2012
Hi GreyHead,

I will try a regex that can do this and post a solution if i found.
If not i will use your first solution.

Not the best one, but solves the problem for now.

Tks,

Renas
This topic is locked and no more replies can be posted.