Stats: 3,230,322 members, 8,084,723 topics. Date: Saturday, 22 February 2025 at 09:43 AM |
Nairaland Forum / Science/Technology / Webmasters / Texarea Truncating Text Issues (807 Views)
Twitter Officially Increased The Text Limit But Some Think It's Not Cool �� / Transcriber Needed. Can You Convert Audio File To Text? Let's Talk / Tip To Write Or Comment In Blue Color Text On Facebook (2) (3) (4)
Texarea Truncating Text Issues by cbrass(m): 4:34pm On Sep 04, 2015 |
Please what do you think is wrong here, when I copy a long post from somewhere and paste it into my textarea then submit, it will cut the post into half sometime not even up to half of the post I submitted will be inserted into the db. Have checked and rechecked my codes but don't seem to know what is wrong I aslo noticed it doesn't behave like that on a particular laptop I use, but when i tried other browsers and laptops but it's still behaving like that Adewasco2k slyrox onyengbu |
Re: Texarea Truncating Text Issues by onyengbu: 5:18pm On Sep 04, 2015 |
cbrass:let me guess, the form submission is being done via ajax/ajax jquery call? |
Re: Texarea Truncating Text Issues by cbrass(m): 6:13pm On Sep 04, 2015 |
onyengbu: Yes bro |
Re: Texarea Truncating Text Issues by spikesC(m): 6:28pm On Sep 04, 2015 |
Log text before database insert I am guessing your column is varchar and of course has a limit |
Re: Texarea Truncating Text Issues by cbrass(m): 6:46pm On Sep 04, 2015 |
spikesC: No it's TEXT |
Re: Texarea Truncating Text Issues by onyengbu: 7:07am On Sep 05, 2015 |
cbrass:I have been into that problem before. It is not database table settings. It is being caused by improper escaping . It is quite a strange occurence then but if you check the text being truncated you will discover that the point of trunctiom has a single quote or apostrophe or some hidden characters. The solution is to use javascript escaping methods (google itcos I cant do that now) and escape the js variable on the jquery side of your script before it gets to php. PHP escaping methods wont help because the text gets truncated before it gets to the server.. If JS escaping method didnt help, use a form submissbon library like form.malsup.com. Even if your textarea is in a loop, you are still fine because you bind each form submit to a class which you create from the ids of your loop. Best regards |
Re: Texarea Truncating Text Issues by cbrass(m): 12:38am On Sep 06, 2015 |
onyengbu: Thanks bro I used encodeURIComponent() to escape the characters before the ajax call and it's working perfectly now Once again thank you |
Re: Texarea Truncating Text Issues by onyengbu: 11:58am On Sep 06, 2015 |
cbrass:Thats exactly what I used back when I had that problem but its been a long time and I can hardly locate which project I used it on. You are welcome. |
(1) (Reply)
GT Bank Gtpay Integration Into Magento / WANTED: Webdesign Company With Government And Bank Portfolio / Please Anybody Know Why The Npower Site Is Currently Down?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2025 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17 |