Posts: 4
Threads: 2
Joined: May 2010
Reputation:
0
May 18th, 2010, 7:42 AM
(This post was last modified: May 18th, 2010, 7:43 AM by rjhart.)
Can someone give me a clue as to how FT handles apostrophe's in form data? Do I need to clean them PRIOR to giving data to FT or does FT do the cleaning some way?
Cleaning data has not been my strong point - any help would be appreciated.
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Heya,
Don't worry - Form Tools takes care of it for you. All form input gets sanitized before it gets inserted into the database so all the SQL queries work properly.
All the best!
- Ben
Posts: 4
Threads: 2
Joined: May 2010
Reputation:
0
May 19th, 2010, 5:17 AM
(This post was last modified: May 19th, 2010, 5:22 AM by rjhart.)
Hi Ben - thanks for the reply. My installation may not be working correctly then. My data is getting cutoff at the apostrophe.. Am I missing something? I just recently downloaded the most recent version - it was a new install, i did not download the API.
Ron
(May 18th, 2010, 4:09 PM)Ben Wrote: Heya,
Don't worry - Form Tools takes care of it for you. All form input gets sanitized before it gets inserted into the database so all the SQL queries work properly.
All the best!
- Ben
P.S. - My installation is on a secure site as well. https.....
Posts: 4
Threads: 2
Joined: May 2010
Reputation:
0
It appears as though I'm losing my data prior to it being submitted to FT. I am going to redo my forms attempting to utilize the API in a multi-form setting.
Not a FT problem ;-)
Posts: 4
Threads: 1
Joined: May 2012
Reputation:
0
Hi - I am new here so I hate to bump an old thread, but I am experiencing the same issue.
Any apostrophe that is copy and pasted from Word looks like this: ‘ and truncates the data.
Any apostrophe that is simply typed into the field (or copied from Notepad) is just fine. It looks like this: '
Anyone have a solution to this? It's really becoming a nightmare for the forms we're using since we're asking people to send in applications that were more than likely composed in Word.
Posts: 5
Threads: 3
Joined: Jun 2012
Reputation:
0
Jun 14th, 2012, 4:43 AM
(This post was last modified: Jun 14th, 2012, 5:10 AM by woodworm.)
I bet this is the same problem as I am experiencing with my £ sign http://forums.formtools.org/showthread.php?tid=2030. I suspect Formtools is being a bit too enthusiastic with its sanitizing routine. There must be a way to fix this - perhaps by adding the rogue characters to a whitelist somewhere........
OK, I found the answer elsewhere, to my problem and possibly this one......
It was Ben suggested add the attribute <form ... accept-charset="UTF-8">
Posts: 143
Threads: 19
Joined: Dec 2010
Reputation:
5
Thank you for searching and helping out woodworm!
Not a FT employee, just a FT user lending a hand. If I've been helpful, please rate.
Posts: 11
Threads: 3
Joined: Mar 2015
Reputation:
0
I have - I believe - a similar problem with apostrophes and quotes in the textbox input but with different results.
I have built a form to enter data from the label of products. Amonst the fields there is one for the brand name. In some cases, that amy include apostrophes, single or double quotes.
Unlike what the other users described, in my case the input doesn't get truncated but, instead, a backslash ("\") is placed before the apostrophe or the quotation mark. I understand that this may be part of the string sanitation that formtools performs. However, each time that an entry with a field containing an apostrophe or quotation mark is updated, an extra backslash is added.
So, for instance, the (hypothetical) brand name "Smith's" would be displayed as "Smith\'s". After another update of the entry that would become "Smith\\\'s" (which makes sense since the backslash needs shielding, too). Another update will lead to "Smith\\\\\\\'s, an so on.
I have verified that the input is saved as such in the database.
Is there any way to address that?
Thanks in advance for your time!
PS I am using FormTools v.2.2.6 and my form is a "Form builder" one.
Posts: 11
Threads: 3
Joined: Mar 2015
Reputation:
0
Apologies for replying to my own post - it's not nice but I've used a workaround that may be of interest to some.
I created a rule in the Hooks Manager module on "ft_update, sumbission, end". In the PHP code box I added the following:
PHP Code: { $haystack="FieldName1FieldName2FieldName3FieldNameetc";
foreach ($_POST as $key => $value)
{ if (strstr($haystack,$key)) { $tmp = str_replace(array("\\'", "\\\""), "`", $value); $_POST[$key] = str_replace(array("\\\\"), "/", $tmp); } } }
What the code does is go through all the text fields of the form, the names of which I have included in $haystack, look for backslashes (\), single quotes (') or double quotes, which upon submission have been changed by formtools to (\\), (\") and (\') and replace them with the forward slashes (/) or " ` " signs.
Thus, the phrase "Smith's restaurant\bar" would be transformed to "Smith`s restaurant/bar".
It is not an elegant solution and not what I was after in the first place (which was to retain the users' input) but for the moment is OKish.
I hope that helps!
G.
(Mar 16th, 2015, 12:57 PM)garof Wrote: I have - I believe - a similar problem with apostrophes and quotes in the textbox input but with different results.
I have built a form to enter data from the label of products. Amonst the fields there is one for the brand name. In some cases, that amy include apostrophes, single or double quotes.
Unlike what the other users described, in my case the input doesn't get truncated but, instead, a backslash ("\") is placed before the apostrophe or the quotation mark. I understand that this may be part of the string sanitation that formtools performs. However, each time that an entry with a field containing an apostrophe or quotation mark is updated, an extra backslash is added.
So, for instance, the (hypothetical) brand name "Smith's" would be displayed as "Smith\'s". After another update of the entry that would become "Smith\\\'s" (which makes sense since the backslash needs shielding, too). Another update will lead to "Smith\\\\\\\'s, an so on.
I have verified that the input is saved as such in the database.
Is there any way to address that?
Thanks in advance for your time!
PS I am using FormTools v.2.2.6 and my form is a "Form builder" one.
|