Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textarea problem

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
IE
Here's the problem i have a text input type on my form

that i converted to a textarea type as i wanted more room

to input text but i am having the following issues

(1) The session variable no longer works ie when you navigate back the text is gone (it remained present in the textbox)
(2)the max option i set no longer works, it is set to 100
but now it is inactive (this also worked when i used the text box)

Tks
Gaz

------------------- Before Change ---------------------

<tr>
<td colspan="2" class="labelcell"><label for = "extra_location_details">&nbsp;&nbsp;&nbsp;Additional Location Details:</label></td>
<td colspan="2" class="fieldcell2"><input type="text" name="extra_location_details" size="100" maxlength="100"
value="<?php if(isset($_SESSION['extra_location_details'])) echo stripslashes($_SESSION['extra_location_details']);?>"/>
</td>
</tr>

------------------- After Change ---------------------


<tr>
<td colspan="2" class="labelcell"><label for = "extra_location_details">&nbsp;&nbsp;&nbsp;Additional Location Details:</label></td>
<td colspan="2" class="fieldcell2"><textarea name="extra_location_details" rows="3" cols="20" size="100" maxlength="100"
value="<?php if(isset($_SESSION['extra_location_details'])) echo stripslashes($_SESSION['extra_location_details']);?>"></textarea>
</td>
</tr>
 
For #2, you'll have to do something like this:

Code:
<textarea rows="5" cols="20" onkeyup="if (this.value.length > 100) this.value=this.value.substr(0,100);"></textarea>

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
for #1, since it seems you're using PHP, try this at the VERY TOP of your php page (right after session_start(), if you've got it):

Code:
header("Cache-control: private");

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
That doesn't seem to work

What does this do header("Cache-control: private");

It seems like a simple chqange from a input type = "text"

to a textarea but it's not working.

Any more suggestions

Tks
 
what doesn't seem to work? #2 works fine for me.

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
When i use it it allows me to enter more than 100 characters
 
Do i have to enable javascript in order for this to work
 
yes.

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
For number 1) you need to output the value for the textarea within the opening/closing tags, rather than in the value attribute:

Code:
<td colspan="2" class="fieldcell2"><textarea name="extra_location_details" rows="3" cols="20"><?php if(isset($_SESSION['extra_location_details'])) echo stripslashes($_SESSION['extra_location_details']);?></textarea>

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top