[#5560] PERL REGEX for validation

8 years 6 months ago #272002 by edmundcheong
Replied by edmundcheong on topic PERL REGEX for validation
I've found another bug related to this. i have done the changes on:

IN: libraries/CBLib/CB/Legacy/cbValidator.php
ON: Lines 73 - 75

And most of the validations worked perfectly well.. but if you have 2 similar fields, different names (in the DB) of course, the first one in the field sequence will have the problem but the second will be fine.

Please Log in to join the conversation.

8 years 6 months ago - 8 years 6 months ago #272011 by krileon
Replied by krileon on topic PERL REGEX for validation
I'm looking into it further. Something not working right. Now the addslashes needs to be added back in or the backslashes are missing in the HTML attribute in my tests after cloning the field. Am investigating further to fix for next nightly.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 6 months ago #272012 by edmundcheong
Replied by edmundcheong on topic PERL REGEX for validation
Hi Kyle, For you info, i did not clone the field. I had 2 existing fields on seperate tabs which are conditioned by cb conditional to show if the drop down single select is equal to xxxx (for example).

I have disabled the conditions and yet it happens. So the temporary fix did solve the earlier problem but the other field in the seperate tab is having this problem.

I will try isolating and give more feedback. Will try if both fields are in the same tab where the regex validation is working.

Please Log in to join the conversation.

8 years 6 months ago #272013 by krileon
Replied by krileon on topic PERL REGEX for validation
Using urlencode and decoding it in the jQuery seams to be the best solution. I've 3 fields 1 after another with same REGEXP and it's working perfectly fine now. I've created the below bug ticket and a MR to fix the issue in next nightly.

forge.joomlapolis.com/issues/5561


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 6 months ago #272015 by edmundcheong
Replied by edmundcheong on topic PERL REGEX for validation

krileon wrote: Using urlencode and decoding it in the jQuery seams to be the best solution. I've 3 fields 1 after another with same REGEXP and it's working perfectly fine now.

forge.joomlapolis.com/issues/5561


Pardon me for my ignorance. can you explain to me how to do this:
Using urlencode and decoding it in the jQuery

Is it by auto action jquery? Is it possible to give me an example?

Normally when is the nightly built is released? Thanks Kyle.

Please Log in to join the conversation.

8 years 6 months ago #272018 by krileon
Replied by krileon on topic PERL REGEX for validation
It requires changes to the PHP side and our cbvalidate jQuery plugin so you'll need to wait for next nightly release. New nightly release will be today after the MR is reviewed, approved, and merged (we use peer review between us 3 to ensure code quality).

You can try the below quickfix, but it'll require your site to stay in debug mode unless you've a JS compression to minify the JS file.

IN: libraries/CBLib/CB/Legacy/cbValidator.php
ON: Lines 73 - 75
FROM:
		} elseif ( $rule == 'pattern' ) {
			$params			=	addslashes( $params );
		}
TO:
		} elseif ( $rule == 'pattern' ) {
			$params			=	urlencode( $params );
		}

IN: components/com_comprofiler/js/jquery/jquery.cbvalidate.js
ON: Lines 674 - 675
FROM:
		if ( typeof params === 'string' ) {
			var delimiter = params.substr( 0, 1 );
TO:
		if ( typeof params === 'string' ) {
			params = decodeURIComponent( params );

			var delimiter = params.substr( 0, 1 );

Note the above will likely be wrong line numbers due to some changes further up in the validation file. You'll need to find the validation rule as follows.

$.validator.addMethod( 'pattern', function( value, element, params ) {

Again this won't work unless you compress the JS to update the minified version or keep your site in debug mode. Also note that some of your issue could be caused by out of date jQuery validate plugin, which has been updated for next nightly as well.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.519 seconds

Facebook Twitter LinkedIn