cformsII Support Forum
Current User: Guest *Frequently Asked Questions*
Search 
Search Forums:


 




Escape character removed

Add a New Topic Reply to Post
Post

Stefan - Guest

8:21 pm - July 17, 2007

1

I'm experiencing some troubles with regular expressions...
I'm using a regexp validating three digits ^\d{3}$ and click on Update settings... When the page refreshes the textbox contain the text ^d{3}$ and the regexp does not validate...

What am I doing wrong?

Oliver - Admin

7:27 am - July 18, 2007

posts 3908

2

Double check the format of this enhanced field name:

field name | default val (optional) | regexp

All '|' are necessary, eg:   my number||^\d{3}$

Stefan - Guest

4:03 pm - July 18, 2007

3

Yeah, the formatting is correct... the thing is that if I, in the textfield, type: Three digit number|###|^\d{3}$ and then save the changes it says Three digit number|###|^d{3}$ in the textfield.

If I type Three digit number|###|^\\d{3}$ (two backslashes) and save it says Three digit number|###|^\d{3}$ the expression works and validates correctly. The problem is that the next time I save the settings the backslash that is still there is removed... and, of course, the expression doesn't work anymore...

Oliver - Admin

6:50 pm - July 18, 2007

posts 3908

4

What version of cforms are you on?
What browser are you using?
Can you post the URL?

With v5.x you can have double backslashes as well as single ones to escape special characters, so this ought to work.

Stefan - Guest

8:34 pm - July 18, 2007

5

cforms 5.2

Tried both IE7 and FF2... The website admin will probably use IE6 or IE7

No use posting the URL since it is an intranet site...

I think you have misunderstood the problem... I can type in 10 backslashes... The problem is that if the settings page is updated 10 times then there's no backslashes left...
One backslash is removed every time the settings are updated, no matter how many backslashes I type in...

Oliver - Admin

9:06 pm - July 18, 2007

posts 3908

6

Sorry I can't help trouble shooting in this case. Again, v5x should work (I've tested it again) - can you try on another host/blog?

Anyone else seeing this? 

Stefan - Guest

9:44 pm - July 18, 2007

7

No worries mate... looks like a nice plugin.
Just wish it had worked in my case...
I'll keep on trying to see if I can find out what's causing it...

Thanks anyway

Brian Hardy - Guest

4:04 am - February 6, 2008

8

I experienced the same issue as Stefan using v7.3. It appears to stem from the fact that you are wrapping all references to the field's regex in a call to PHP's stripslashes() function, which will... strip the slashes.

I went through and removed what I think are all the relevant calls, and it seems to work for me in both the form editing interface, javascript form submission validation and non-ajax form submission. For your reference, here are the lines I modified (each just removes the stripslashes call):

cforms-options.php: 292

cforms.php: 1094 or 1090 (my version was missing 4 lines from 281-284 vs the downloaded version)

lib_nonajax.php: 87,127

Perhaps there's a reason I'm not anticipating for wanting to strip slashes from these, but it's working for me so far.

FYI this is using Firefox 3b2, PHP 5.x, WP 2.3.2

Oliver - Admin

7:35 am - February 6, 2008

posts 3908

9

Thanks Brian. It's odd though, because I don't see this happening on any of my test blogs and it only has been reported twice so far.

If you don't strip the slashes (per your adjustments) can you still use single quotes properly or do you now get a \'?

For whatever reason (blog's charset maybe?) it appears that your blog saves entered, 'escapable' characters (\, ', ") directly without adding the slash. If that's the case then you should be fine with your modifications.

Gary Dalton - Guest

11:09 pm - February 8, 2008

10

Yes, I am also seeing this problem. I recently upgraded from an older version of CForms II. Likely a strip slashes issue as indicated. I did not, however; dig through the source.

System:

FreeBSD 6.1-RELEASE-p10

PHP 4.4.7 with Suhosin-Patch 0.9.6 (cli) (built: Nov 10 2007 10:17:01)
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with Suhosin v0.9.20, Copyright (c) 2002-2006, by Hardened-PHP Project
    with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies

Apached 2.0.61

Mysql-server-4.1.22

Gary Dalton - Guest

11:12 pm - February 8, 2008

11

Oh, forgot to mention Wordpress stuff.

Using WordPress -MU version 1.3.3

This was updated about 3 days ago.

BTW: Thanks for a wonderful form handler.

Gary

Oliver - Admin

11:30 am - February 9, 2008

posts 3908

12

This seems to be the second occurance, quite odd. I'd like to take a look, 'will send you an email.

Rich Smith - Guest

10:42 pm - March 18, 2008

13

You can add me as the third person this is happening to.

I use the latest Wordpress installation and my webhost is Dreamhost.  Wonder what's causing the problem?

Rich Smith - Guest

1:28 pm - March 19, 2008

14

The solution above doesn't work for me because the lines aren't the same and I don't know what to with the lines once I find them!  I only found one... commented the line out and broke the plug-in. Don't know what to do... help!

Oliver - Admin

6:51 pm - March 19, 2008

posts 3908

15

I sent you an email.

Reply to Post


Reply to Topic: Escape character removed
PLEASE READ THE FAQs FIRST! THANK YOU.

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Topic Reply:

Save New PostSmileysOptions

Guest URL (required)

Math Required!
What is the sum of:
6 + 10
   

 
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell

Search