Forums

Validation rule with regular expression is not working

cambium 26 Jun, 2018
Hello!
I have the problem with validation one rule.
In Validate Data action i set some rules on list Fields setup:
text28/is_integer:{error:Error! wrong type of field value.}   //it works
med1/is_integer:{error:Error! wrong type of field value.} // it works
med2/is_integer:{error:Error! wrong type of field value.} // it works
med3/is_integer:{error:Error! wrong type of field value.} // it works
med4/is_integer:{error:Error! wrong type of field value.} // it works
curip/regExp[/([0-9]{1,3}[\.]){3}[0-9]{1,3}/]:{error:Error! wrong type of field value.} // i have error here
The last rule gives the error " Call to undefined method G2\L\Validate::regExp[()". What wrong is? Or i can't use validation rules in this field?

Many thanks for answer
cambium 27 Jun, 2018
Hi,
I did. Got an error.
healyhatman 27 Jun, 2018
As far as I can tell it's a bug, the closest I can get it tells me "Too few arguments to function G2/L/Validate::regex(), 1 passed blahblahblah" I don't know how to make it pass two arguments or why it should need to.

I'd suggest use the Contact link and sending the developer an email. If he replies to you, post the response here🙂 Or make a post in the Bug forum
cambium 27 Jun, 2018
I got the same error, but the rule with "regExp" (with other expression and other field of rules) is working.
Besides i tryed to use the some other rules (in settings of other elements ) - they are not working too (alpha, alphanumeric and so on). Then i used rules with "regExp" and it worked there.
But here, in "Fields setup" of Validate Data action this rule doesn't work again.
I don't know yet, is it a bug or not. Maybe i did something wrong. Or can't use thire rules here.
healyhatman 29 Aug, 2018
1 Likes
Current investigation so far
regtest/regex/[/^[0-9]{3}$/]):Regex failed
gives me
Too few arguments to function G2\L\Validate::regex(), 1 passed in /.../libraries/cegcore2/admin/extensions/chronofc/functions/validate_data/validate_data_output.php on line 22 and exactly 2 expected


Line 71 in cegcore2/libs/validate.php is where that is called as far as I can see. I tried a file_put_contents to log what those values were and they were both empty ($value and $regex) so who knows what's going on there.

A response would be nice, it has been two months.
healyhatman 18 Jan, 2019
BUMP

Still trying to figure it out. I've sent emails about it too. Maybe next year?
healyhatman 18 Jan, 2019
In libraries\cegcore2\admin\extensions\chronofc\functions\validate_data\valudate_data_output.php, line 22,
 if((bool)\G2\L\Validate::$vfn(\G2\L\Arr::getVal($data, $field_data['name'], null)) !== true){
Doesn't have a spot for the value to be passed.

libraries\cegcore2\admin\extensions\chronofc\helpers\parser.php, line 928, doesn't have the code to get the value to be checked.
healyhatman 18 Jan, 2019
I GOT IT!!!!!!

After months of not doing very much, and many hours of actual work, I figured it out. I'll send the information to the developer and see if he can update the code.
Max_admin 22 Jan, 2019
Answer
1 Likes
Hi,

The next update should have this issue fixed!

The syntax will be like this:
curip/regex[/([0-9]{1,3}[\.]){3}[0-9]{1,3}/]:Error! wrong type of field value.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Elita- 04 Mar, 2019
Hi, Max! what about this regex issue? Did you get that fixed?
healyhatman 04 Mar, 2019
Yes it was updated in 6.0.22
healyhatman 04 Mar, 2019
i also made another post showing you all the validation options available
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger