textarea not displaying data properly (solved)

A place for users and developers of the Xataface to discuss and receive support.

textarea not displaying data properly (solved)

Postby casanovax7 » Thu Sep 06, 2012 2:49 pm

I have set up a field to show a textarea type widget, and data is entered into the field, saved to the database, but when the record is viewed in edit mode, the data does not display... I can't find anyone with a related issue - maybe there is some setting I need to know about for this? Right now it is kind of a big problem, because if someone edits the record later, the data that was saved is now cleared out (presumably because the field is blank in the edit view)...
Last edited by casanovax7 on Thu Oct 04, 2012 2:22 pm, edited 1 time in total.
casanovax7
 
Posts: 20
Joined: Wed Sep 05, 2012 3:36 pm

Re: textarea not displaying data past 300 characters

Postby casanovax7 » Thu Sep 06, 2012 6:02 pm

I figured out the issue. It was not a text length issue, but one of characters: you’ll feel like you've - the first apostrophe is what Word types, and the second is what a browser or notepad types. The first does not work in my database and causes the data to not appear in the browser when someone pasted it into the textarea and then saved the record.

Does anybody know the best way for me to automatically replace all ’ with ' ? I would assume some kind of delegate class that goes through the whole record before being saved and replaces everything would be best, but if anybody has any shortcuts for that, I'd really appreciate it... Thanks!
casanovax7
 
Posts: 20
Joined: Wed Sep 05, 2012 3:36 pm

Re: textarea not displaying data past 300 characters

Postby shannah » Sat Sep 08, 2012 10:43 am

I have seen this before, but don't recall what the solution was. You might try to play with the encodings
e.g. default_oe and default_ie directives in the conf.ini file.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: textarea not displaying data past 300 characters

Postby casanovax7 » Thu Oct 04, 2012 2:02 pm

Just wanted to follow up on this and leave a message in case anybody else in the future has this issue.

To recap: I built a database utilizing Xataface as the front end for the sole purpose of collecting, sorting, and revising text and image data on vendors my company uses (this data would put uploaded to another system later). We have about 7 people working on this all the time, and some people were writing descriptions in Word and then copying and pasting into Xataface. An issue arose when hyphens or single/double quote or ellipses were used because they come over from Word as different characters. The data was being stored in the database properly, but when someone would edit the same record later, the data would not show up in the textarea widget, and if the record was saved, the data was deleted. I played around with encodings and anything else I could think of to try to get the data to show up when these symbols were present, but to no avail. I finally decided to simply do a find/replace for each of the characters every time the record was saved. It took FOREVER to find a proper and easily implemented solution, but eventually I did. Below is the code I use to rid the data of the crappy Word characters:

Code: Select all
function afterSave(&$record){
    $app =& Dataface_Application::getInstance();
    $query =& $app->getQuery();
    $recordid = $record->getValue('Id');
    $sql = "UPDATE vend_01 SET Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(145), '\''), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(146), '\''), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(147), '\"'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(148), '\"'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(150), '-'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(151), '--'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(133), '...') WHERE Id='$recordid'";
    $res = mysql_query($sql);
...
}


I created queries for each field that needed it (for me that was 7) and simply changed out the field name in the query and iterated my variables (so $sql2 and $res2, etc.), and it now works just perfect. Sorry for the long post on an old topic, but Xataface has been an absolute life-saver when it comes to our project and this aspect of it took me the longest; hopefully someone finds this useful in the future!
casanovax7
 
Posts: 20
Joined: Wed Sep 05, 2012 3:36 pm

Re: textarea not displaying data properly (solved)

Postby shannah » Thu Oct 04, 2012 3:21 pm

Thanks for posting this. Now, the million dollar question is why these characters are causing the MySQL connection to choke.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: textarea not displaying data properly (solved)

Postby silma » Fri Oct 05, 2012 5:26 am

Hello,

The trouble is not with MySQL, but with word "smart quote".

There a few post about it, but no true and definitive solution :(
http://www.toao.net/48-replacing-smart-quotes-and-em-dashes-in-mysql
http://www.codingforums.com/archive/index.php/t-47163.html

You also have the solution to install Open office...
silma
 
Posts: 87
Joined: Tue Apr 28, 2009 11:47 pm

Re: textarea not displaying data properly (solved)

Postby casanovax7 » Mon Oct 08, 2012 1:58 pm

Haha, yeah, I tried to get everybody to install OpenOffice but was put in my place shortly thereafter. I think that's the solution when you only have a couple people working, but we have about 7-10 people working on stuff at any given time and I think everybody who uses Word is happy with it (and doesn't want to install more software).

Still, I think it's funny you mention the first thing I tried; totally forgot to mention it myself! :lol:
casanovax7
 
Posts: 20
Joined: Wed Sep 05, 2012 3:36 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 19 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved