Keep data entered into a form’s texarea fields from disappearing when form is re-sent?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 2, 2012   (RSS)

By gkornbluth - July 1, 2012 - edited: July 1, 2012

Hi All,

Has anyone figured out how to keep the data entered into the texarea fields of a form from disappearing when the form is re-sent (during error checking, etc.)?

The entered data is kept when the field is an <input type=text field, but not when it's a <textarea field.

For example:
Anything typed into this and other "text" type fields retain theirs value when re-sent,
<input type="text" name="username" value="<?php echo htmlspecialchars(@$_REQUEST['username']); ?>" size="50" />

And anything typed into this and other textarea type fields lose their value when re-sent.
<textarea name="describe_your_artistic_discipline" COLS=50 ROWS=6 value="<?php echo htmlspecialchars(@$_REQUEST['describe_your_artistic_discipline']); ?>"></textarea>

NOTE: OK I found that there is no value attribute for textareas and that I'll probably have to use JS or something. But I still don't know how to accomplish the task.

Any help would be wonderful ...

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Keep data entered into a form’s texarea fields from disappearing when form is re-sent?

By Jason - July 2, 2012

Hi Jerry,

To put information into a textarea, you output it between the <textarea> tags.

For example:

<textarea name="describe_your_artistic_discipline" COLS=50 ROWS=6 ><?php echo htmlspecialchars(@$_REQUEST['describe_your_artistic_discipline']); ?></textarea>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/