content not showing in text area?
Asked Answered
U

6

5

I have a textarea and for some reason when I try to add text in between the open and close brackets of my textarea it wont display, whether I use html content or php echoed content.

It works if I place the content in a place holder though, does anyone know why this is happening?

<form action="includes/changebio.php" method="post" id="form1">         
 <textarea id="bio" style="width: 440px; 
    margin-top:3px;
    text-align:left;
    margin-left:-2px;
    height: 120px;
    resize: none; 
    outline:none;
    overflow:scroll;
    border: #ccc 1px solid;"
    textarea name="bio" data-id="bio" 
    maxlength="710" 
    placeholder="<?php echo stripslashes($profile['bio']); ?>" rows="10">
 </textarea>
<input type="image" src="assets/img/icons/save-edit.png"
       class="bio-submit" name="submit" value="submit" id="submit"/>
</form>
Uranic answered 16/4, 2013 at 0:10 Comment(4)
I tried your code on my windows machine and I had no problem.Septal
its currently set as a placeholder though, if u take the content out of the place holder and place it between <textarea>..</textarea> it doesnt show for meUranic
Make sure your $profile['bio'] is not empty.Septal
it does it even if i replace $profile['bio'] with html and still wont displayUranic
H
12

Try adding a name="textarea-name"attribute to the textarea (even if you have no use for it)

Edit:

I have tested a <textarea name="bio">textarea content</textarea> piece of code and concluded that (as strange as it may seem), if the textarea name is bio, the content is no shown in Firefox, although it is present if the element is inspected with Firebug or a similar tool.

It appears to be something caused by one of my add-ons, as the textarea content it is displayed correctly by other browsers and when using a clean new Firefox profile.

I have not investigated further though.

Hacienda answered 6/6, 2013 at 10:18 Comment(2)
Super! How is it but?!! can You please explain?Kiley
Disabling and re-enabling uBlock Origin solved the problem for me on FF 125.0.2 (64-bit) on Ubuntu 22.04. Text was working outside of a <form> element but if the <textarea> was inside of a form element, no text showed up, regardless of using a name or setting the .textContent with JS. No idea why.Fidgety
B
5

Simplest method that worked for me:

Instead of doing:-

<textarea name="scenario" value="<?php echo $scenario?>"> </textarea>

Do it like this:-

<textarea name="scenario"> <?php echo $scenario?> </textarea>
Bronchiole answered 24/6, 2016 at 0:25 Comment(0)
K
2

I have similar problem! When I change the content with ajax, Chrome & Firefox displayed nothing, but IE displayed correctly. What strange is the content is present if the element is inspected with Firebug or a similar tool.

Kneeland answered 28/7, 2017 at 8:45 Comment(0)
S
0

You have extra textarea after style tag. Here is the code.

<form action="includes/changebio.php" method="post" id="form1">         
<textarea id="bio" style="width: 440px; 
 margin-top:3px;
 text-align:left;
 margin-left:-2px;
 height: 120px;
 resize: none; 
 outline:none;
 overflow:scroll;
 border: #ccc 1px solid;" name="bio" data-id="bio" maxlength="710"
placeholder="<?php   echo stripslashes($profile['bio']); ?>" rows="10"><?php echo stripslashes($profile['bio']); ?></textarea>
<input type="image" src="assets/img/icons/save-edit.png"class="bio-submit" name="submit"  value="submit" id="submit"/>
</form>
Septal answered 16/4, 2013 at 0:32 Comment(0)
A
0

If your problem is same as mine, where I placed a string variable with 1500 chars for a web content, between the two tags, and only partial appeared inside the Textarea on the page. Only about 900 chars displayed. A large part at the end were missing. Then, you may try what worked for me, where I used the htmlspecialchars() function like this:

<TEXTAREA><?php echo htmlspecialchars($pgCont); ?></TEXTAREA>

I still don't know why this function may be required to show the full contents of the string variable. Perhaps, for security reasons.

Adiathermancy answered 7/1, 2022 at 4:33 Comment(0)
S
-1

I also faced the similar problem and resolved it by doing like this:

{{\App\ArtObject::find($id)->description}}

Earlier I had: description}}">

The later case did NOT show the value as expected.

Saavedra answered 23/4, 2017 at 12:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.