textarea predefined text 
June 19th, 2009, 12:09 AM
| | Newbie | | Join Date: Jun 2009
Posts: 4
| |
Hey how are you guys?
Well I have a little question.
How can I add predefined text to this textarea? :S .
Thanks in advanced :D. - <tr>
-
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
-
<tr class="infoBoxContents">
-
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
-
<tr>
-
<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?></td>
-
</tr>
-
</table></td>
-
</tr>
-
</table></td>
-
</tr>
Last edited by Atli; June 19th, 2009 at 12:16 AM.
Reason: Changed [quote] tags to [code] tags.
| 
June 19th, 2009, 12:20 AM
|  | Moderator | | Join Date: Nov 2006 Location: Iceland
Posts: 3,701
Provided Answers: 4 | | | re: textarea predefined text
Hi.
Is that function meant to create your textarea?
If so, you would have to edit that function.
You could simply add a parameter for the predefined text, and have it added when the function prints the textarea.
| 
June 19th, 2009, 12:24 AM
| | Newbie | | Join Date: Jun 2009
Posts: 4
| | | re: textarea predefined text
Hrmm, okay I see.
You think the function could be <tr class="infoBoxContents"> by any chance?
And thanks for replying so fast!
| 
June 19th, 2009, 12:42 AM
|  | Moderator | | Join Date: Nov 2006 Location: Iceland
Posts: 3,701
Provided Answers: 4 | | | re: textarea predefined text
Nope, that would be the top of a table row :)
The function I suspect is creating your textarea is tep_draw_textarea_field.
Do you have that anywhere?
In any case, a simpler, albeit less elegant, way to do this would be to just put the textarea into a PHP variable before echoing it and injecting your text.
Somewhat like: -
<?php
-
// The text that should be added
-
$predefinedText = "Hello, this is some text to inject into the textarea.\n\n";
-
-
$originalArea = tep_draw_textarea_field('comments', 'soft', '60', '5', $comments);
-
echo preg_replace('/(<textarea[^>]*>)/i', '$1'.$predefinedText, $originalArea);
-
?>
| 
June 19th, 2009, 01:08 AM
| | Newbie | | Join Date: Jun 2009
Posts: 4
| | | re: textarea predefined text
Awsome!
I will give this a try right away, thank you very much.
I'll reply with results.
| 
June 19th, 2009, 01:24 AM
| | Newbie | | Join Date: Jun 2009
Posts: 4
| | | re: textarea predefined text
Yay.
Worked very well!!!!
You rock Atli :D.
Thank you very much, I hope to stay in this community, and later on help others.
| 
June 19th, 2009, 02:01 AM
|  | Moderator | | Join Date: Nov 2006 Location: Iceland
Posts: 3,701
Provided Answers: 4 | | | re: textarea predefined text
I'm glad it worked!
Hope I'll be seeing you around :)
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|