Gossamer Forum
Home : Products : DBMan : Customization :

Loosing Everything After a quote

Quote Reply
Loosing Everything After a quote
If I include double quotation marks(") in a field (not '), I loose everything after the first double quote (") mark when I modify the record.

Is this a limitation of DBMan, or is this a bona-fide configuration/customization issue.

Any help on where to get started would be appreciated.

Thank you

mark kuenzel

Quote Reply
Re: Loosing Everything After a quote In reply to
Update...

I found a few other posts regarding double quote marks, but not really an answer as to whether or not there is a workaround.

I did add the following line to sub_parse_form:

$value =~ s/\"/\'/g;

This replaces " with ' and works for now. I would like to be able to use " in the data though.

-Mark

Quote Reply
Re: Loosing Everything After a quote In reply to
You could try a more devious workaround.

Use

$value =~ s/\"/\'\'/g;

in sub parse_form. (That's two single quotes that you are substituting for a double quote.)

Then you can substitute them back in sub html_record and sub html_record_form:

Code:
foreach $col (@db_cols) {
$rec{$col} =~ s/\'\'/\"/g;
}
That will put the double quotes back into the fields.


JPD
Quote Reply
Re: Loosing Everything After a quote In reply to
I like your devious workaround.

However, on further investigation I nailed down that when a record containing a double quote was displayed for modifying, the first double quote actually ends the value="" attribute for the <input> html tag in the form.


It looked something like this: <input type="text" value="the man said,"Hello!"">

When that displayed record was modified, only "the man said," was put into the database.

To get around the whole quote thing I used the following in sub parse_form:

$value =~ s/\"/&q_uot\;/g;

(with the _ removed. I couldn't write the code in this post without using an underscore so it would display the actual character entity, and not a ")

It seems to work. If someone enters a " as part of the field, it is converted to the equivelant html character entity ("). That way when the record displays in the browser, there's no actual " in the html code to prematurly end a value attribute.

Make sense?, or am I making some gross mistake.

-Mark

Quote Reply
Re: Loosing Everything After a quote In reply to
Ah. I see. I was wondering why it would happen the way you described it. Turns out it isn't a Perl problem or a DBMan problem. Smile

Your workaround looks good. Better than mine because you only have to make one change.


JPD