...

View Full Version : # of cols in a text area question.



canadianjameson
10-13-2004, 01:46 AM
Hey. I have a form which is being submitted and the info is sent to a success page. the data entered into the form is displayed in a neat table format suitable for printing. My question is as follows.

i have a textarea in my form that is configured as follows:


<textarea name="Application_Information" cols="78" rows="12" wrap="HARD" id="textarea" tabindex="16" style="FONT-FAMILY: Georgia, Times New Roman, Times, serif; font-size: 14"></textarea>


the data entered in it is passed to the success page and displayed in a table configured as such (slightly trimmed down code):


<table width="536px">
<tr>
<td width="30%" align="left" valign="top">
<strong>Application Information:</strong></td>
<td width="70%" valign="top">
<pre><font size="2" face="Georgia, Times New Roman, Times, serif">
{= param.Application_Information =}</font></pre></td>
</tr>
</table>


my problem is that when a user types a full sentence in the text area (uses all 78 cols), the resulting output on the success page moves the divider between the two <td> cells... not respecting the 30% and 70% of the 536 px i have specified.

how do i make the <td> widths immune to moving around, regardless of whether or not the 78 cols are used or not?

Roy Sinclair
10-13-2004, 04:05 PM
Remove the <pre></pre> tags and replace the embedded CRLF characters with <br> tags.

canadianjameson
10-13-2004, 09:57 PM
wouldnt that only work IF the user hits ENTER? and if they dont it just runs on? <pre> seems to work fine... i just need to make the <td> widths immutable... should i define a pixel width instead of a % width?

would your suggestion look like this:


<table width="536px">
<tr>
<td width="30%" align="left" valign="top">
<strong>Application Information:</strong></td>
<td width="70%" valign="top">
<font size="2" face="Georgia, Times New Roman, Times, serif">
<br>{= param.Application_Information =}<br></font></td>
</tr>
</table>

AaronW
10-13-2004, 10:05 PM
Why are you using percentages anyway? You know the width of the parent, and you only have two columns... Just make them pixels.

30% of 536 = ~161
536 - 161 = 375

canadianjameson
10-13-2004, 10:13 PM
i tried that, it didnt work. when long sentences are entered into the text are, it still pushes the 30% to about 15%

here's the code


<table width="536px" style="border: solid 1px black;" cellspacing="0" cellpadding="1">
<tr>
<td width="161" style="border-bottom: solid 1px black; border-right: solid 1px black;"><strong>Producer:</strong></td>
<td width="375" valign="middle" style="border-bottom: solid 1px black;">{=param.Producer =}&nbsp;</td>
</tr>
<tr>
<td width="161" style="border-bottom: solid 1px black; border-right: solid 1px black;"><strong>Product: </strong></td>
<td width="375" valign="middle" style="border-bottom: solid 1px black;">{=param.Product =}&nbsp;</td>
</tr>
<tr>
<td width="161" style="border-bottom: solid 1px black; border-right: solid 1px black;"><strong>Quantity:</strong></td>
<td width="375" valign="middle" style="border-bottom: solid 1px black;">{=param.Quantity =}&nbsp;</td>
</tr>
<tr>
<td width="161"align="left" valign="top" style="border-right: solid 1px black;"><strong>Application Information:</strong></td>
<td width="375" valign="top">
<pre><font size="2" face="Georgia, Times New Roman, Times, serif">{= param.Application_Information =}</font></pre></td>
</tr>
</table>


check it for yourself. enter alot of data in the text field and hit submit.
www.enviromark.ca/english/quoteform.html

Roy Sinclair
10-13-2004, 10:22 PM
Try it without the <pre></pre> tags and see if it still shows that problem.

canadianjameson
10-13-2004, 10:26 PM
fixed it, thx aaron

go canada!

canadianjameson
10-13-2004, 11:26 PM
Roy, you were right

evil <pre> tags :rolleyes:

]|V|[agnus
10-15-2004, 07:55 AM
The only evil tags I saw started with <font...

canadianjameson
10-15-2004, 08:37 PM
and perhaps <head> and <body> . . .

*shifty eyed look around*

where are the <feet>, hmmmMM?!

i dont trust them feetless entities... constantly plotting :cool:

]|V|[agnus
10-15-2004, 08:40 PM
uh...

canadianjameson
11-04-2004, 12:32 AM
Roy. i realised after i msg'd you that perhaps i should have posted it here. sorry

i'll do both.


Roy:

you helped me fix my problem regarding <pre> tags (et al.) on this thread
however now the resulting form output does not display any ENTER keystrokes. you suggested something (bolded), but i didnt know what you meant

Remove the <pre></pre> tags and replace the embedded CRLF characters with <br> tags.

i was wondering if you could just elaborate, or show me how to do it.

the output page with (i think) the "CRLF" characters is this:


<table width="536px">
<tr>
<td width="30%" align="left" valign="top">
<strong>Application Information:</strong></td>
<td width="70%" valign="top">
<pre><font size="2" face="Georgia, Times New Roman, Times, serif">
{= param.Application_Information =}</font></pre></td>
</tr>
</table>


wouldn't replacing the {= tags with <br> tags kill the effect? i assume '{=' is like '<'


Thanks, and sorry again for the double post

Roy Sinclair
11-04-2004, 04:50 PM
No, you don't want to replace the {= and =} tags, those appear to be part of your server side code. It's the data inside param.Application_Information that needs to have it's embedded CRLF's replaced by <br> tags using the appropriate server side code.

For example you have the following text (^CRLF will represent in the example text where an actual carriage return and linefeed sequence would appear:

Line 1^CRLFLine 2^CRLF^CRLFLine 3

What you need to output to the html page is:

Line 1<br />Line 2<br /><br />Line 3

In ASP, I would code that as <%= Replace(param.Application_Information,vbCRLF,"<br />")%> but your server side code is obviously not ASP so you need to find the equivalent in your server side language and use it.

canadianjameson
11-04-2004, 11:23 PM
I took your advice and moved the question to the Perl / CGI forum.

Thanks Roy, much appreciated.

http://www.codingforums.com/showthread.php?p=247457#post247457

Hope i can get this working so my bid to have the sexiest, most functional web page can continue on its merry way :)

canadianjameson
11-05-2004, 06:24 PM
Roy, i posted my question to the people who wrote the TFMail script. although their answer was less than helpfull on the perl end, they did suggest something that i found interesting. i wanted your opinion on whether it would work: i bolded it. it would involve putting back in the <PRE> tags



> i'm having a problem with TFMail. I have a text field on a form that
> is being displayed on a success page. The problem is that the ENTER
> keystrokes entered on the form are not being transfered over to the
> success page

Yes that is correct. Browser don't care about whitespace (and an enter
is whitespace). It is not a problem with TFMail.

>
> i was told that in ASP you'd use this: <%= Replace(param.Application_Information,vbCRLF,"<br />")%> instead of this: {= param.Application_Information =}.
>
> What would the correct syntax be for this script? unless it's been
> fixed in the new version of the script.
>

There is no syntax and it is not something we can 'fix' - we do not know
how people are going to use the output of the program and having it
'fixed' to insert arbitrary characters in the form input is likely to
break things for other people.

What we would recommend is that you put the output into a <div /> block
and use CSS to restrict the width so that it wraps inside the DIV.

e.g.

<div style="width: 80%;">
{= param.Application_Information =}
</div>

and that should do the job.
/J\


Thanks Roy

Roy Sinclair
11-05-2004, 07:04 PM
Give it a try and see. If the code just needs to fit nicely then that would do the trick, if it's got to have line breaks at exactly the same points it did when originally typed then a regular expression like: s/\0d\0a/&gt\;BR&lt\;/go should be used to fix the line breaks.

canadianjameson
11-05-2004, 09:47 PM
the div thing didnt work at all. i didnt think it would.

i dont get it roy. if i have a table cell with the width DEFINED, shouldnt that be immutable?!! the data comming into the TD simply stretches it as if i hadnt set the width in pixels at all!

what do i do from here? the writters of the program claim that how the output is used is none of their concern... GFJ!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum