Subject: Align text in textarea
Posted By: crmpicco Post Date: 5/16/2005 4:30:19 AM
How do i Align text in textarea left?

Picco

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: meow Reply Date: 5/16/2005 4:39:25 AM
If you use a left-to-right language you don't need to do anything.

Otherwise, look here:
http://www.w3.org/TR/REC-CSS2/text.html#propdef-text-align

(o<
//\       =^..^=
Reply By: crmpicco Reply Date: 5/17/2005 10:54:36 AM


Can someone tell me where i can find that character on the keyboard?

TIA.

Picco

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 5/19/2005 6:36:06 AM
quote:

If you use a left-to-right language you don't need to do anything.

Otherwise, look here:
http://www.w3.org/TR/REC-CSS2/text.html#propdef-text-align


i am bringing the textarea's content back from XML. Its seems to move the content more to the  centre of the textarea.


<textarea name="content<%=a%>" id="content<%=a%>" cols="100" rows="5" wrap="PHYSICAL" style="font-family:Verdana, Arial, Helvetica, sans-serif; text-align:left">
        <%
        
        if left(rulexml.selectnodes("rules").item(0).selectnodes("fare_rule_lines").item(a).selectnodes("content").item(0).text,15) <> "<table><tr><td>" then
        response.write "<table border=1><tr><td>"
        end if
        %> 
        <%=fix_characters(rulexml.selectnodes("rules").item(0).selectnodes("fare_rule_lines").item(a).selectnodes("content").item(0).text)%>
        <%
        ' if there is no end table tag then create one to end the table
        if right(rulexml.selectnodes("rules").item(0).selectnodes("fare_rule_lines").item(a).selectnodes("content").item(0).text,18) <> "</td></tr></table>" then
        response.write "</td></tr></table>"
        end if 
        %>
        </textarea>


www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 5/20/2005 6:28:56 AM
is this a XML issue?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: meow Reply Date: 5/20/2005 6:59:43 AM
The output of that script would be more useful. Do you write a table in the textarea? You can't do that.

(o<
//\       =^..^=
Reply By: crmpicco Reply Date: 5/20/2005 7:02:42 AM
inside my textarea is:
<table><tr><td>AF</td><td>UK/CDG</td></tr><tr><td>(AF)</td><td>All flights must be booked under AF prefix</td></tr><tr><td>WORLDWIDE / NORTH ATLANTIC</td></tr><tr><td>(AF)</td><td>all flights to be booked under AF prefix</td></tr><tr><td>Code share flights (AF prefix)</td></tr><tr><td>Franchise Flights (AF prefix)</td></tr><tr><td>Exception</td></tr><tr><td>These cannot be combined with KLM flights.</td></tr><tr><td>KL</td><td>UK/AMS</td></tr><tr><td>(KL)</td><td>KLM & KLM Cityhopper UK</td></tr><tr><td>WORLDWIDE / TRANSATLANTIC</td></tr><tr><td>(KL)</td><td>KLM</td></tr><tr><td>Please note irrespective of the ticket stock used (057 or 074), AF/KL combinations are only permitted</td></tr><tr><td>when the operating or marketing carrier is Air France or KLM only. In this case only, AF and KL flight</td></tr><tr><td>prefixes must be used. Under no circumstances does the combination permit other partner airlines.</td></tr>

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: meow Reply Date: 5/20/2005 7:13:02 AM
Well, you can't do that. A textarea can only contain plain text, i.e. no tags.


Nevertheless, the text is left aligned for me.
Reply By: crmpicco Reply Date: 5/20/2005 7:13:35 AM
ok, thanks

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 5/20/2005 7:18:49 AM
i dont get an error - it just center aligns the first line

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: richard.york Reply Date: 5/20/2005 7:59:35 AM
> Well, you can't do that. A textarea can only contain plain text, i.e. no tags.

That's not true. Most web-based WYSIWYG editors work using textareas, where the content of the textarea is copied to an inline frame for visual editing, and the textarea itself is used for "view source" mode. In my own experience the only tags a textarea cannot contain are nested textareas, the browser gets confused and closes the first one upon encountering the first closing tag.

It would help more to see a link to the output of the script.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply By: meow Reply Date: 5/20/2005 8:22:33 AM
Yes, I know it works in practice. But the case you describe is user input. Not coded in HTML. IIRC the content of textarea is #PCDATA, so if you want it to be valid the tags should be escaped. No doubt it works in all or most browsers anyway.

(o<
//\       =^..^=
Reply By: crmpicco Reply Date: 5/20/2005 8:40:38 AM
no, sorry. it is coded in the ASP page. here is the code:

        <textarea name="Content" cols="100" rows="6" wrap="PHYSICAL" style="font-family:Verdana, Arial, Helvetica, sans-serif; text-align:left"><%=trim(rs("Content"))%></textarea>



can i still not be left-aligned? i have tried 'trim'

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: meow Reply Date: 5/20/2005 8:43:12 AM
Wait, I think I get what you mean now crmpicco. Better late than never, huh?

When the script is parsed it probably leaves some whitespace in the beginning of the form. Since spaces do render in a textarea... Could that be it? See if you can select the whitespace with your mouse.

(o<
//\       =^..^=
Reply By: crmpicco Reply Date: 5/20/2005 8:55:31 AM
yes, i can highlight the whitespace with my mouse

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: richard.york Reply Date: 5/20/2005 8:58:29 AM
Sure, we are talking tag soup here, right?

I think the best way to go about it is to put the HTML off to the side in a separate containing <div> (with default display: none), and then populate the <textarea> from script by reading the contents of that <div>. That takes care of validation errors, and also troubles with nested textareas.

Course the best way to go about populating the textarea from the div is via the non-standard (or defacto standard) innerHTML property. In these types of applications though, standards tend to go out the window because browser support is so varying. WYSIWYG only works on either the proprietarty Microsoft MSHTML, or Mozilla Midas platforms anyway. I heard Safari has one too now, but I don't know what they're calling it. So interoperability is limited by circumstance and lack of standardization.

I've also heard that HTML 5 will address many issues like this, e.g. the DOCTYPE not allowing certain elements to live inside of certain other elements, standardization of the innerHTML property, etc.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply By: crmpicco Reply Date: 5/20/2005 9:49:33 AM
how do i do that? this is how my table looks:

<table bgcolor="#ececec" border="1" bordercolor="#000000" align="center">
    <tr bordercolor="#ececec">
      <td colspan="3"><div align="center"><span class="style6">Rule <%=cint(a)+1%> </span></div></td>
    </tr>
    <tr bordercolor="#ececec">
      <td width="185"><div align="right" class="style3">Heading</div></td>
      <td width="1">&nbsp;</td>
      <td width="559"><div align="left">
      <!-- Insert the Heading into the textbox and remove all problematic characters e.g. Apostrophes and Colons -->
      <!-- Change to UpperCase and remove any whitespace -->
<input name="heading<%=a%>" id="heading<%=a%>" type="text" size="100" value="<%=fix_characters(ucase(trim(rulexml.selectnodes("rules").item(0).selectnodes("fare_rule_lines").item(a).selectnodes("heading").item(0).text)))%>" style="font-weight:bold; font-family:Verdana, Arial, Helvetica, sans-serif">
      </div></td>
    </tr>
    <tr bordercolor="#ececec">
      <td><div align="right" class="style3">Content</div></td>
      <td>&nbsp;</td>
      <td align="left"><div align="left">
        <textarea name="content<%=a%>" id="content<%=a%>" cols="100" rows="5" wrap="PHYSICAL" style="font-family:Verdana, Arial, Helvetica, sans-serif; text-align:left">
        <%
        
        if left(rulexml.selectnodes("rules").item(0).selectnodes("fare_rule_lines").item(a).selectnodes("content").item(0).text,15) <> "<table><tr><td>" then
        
            '... if the airline is CSA Czech Airlines then create a table 
            '... with a border
            if airline_code = "OK" then
            response.write "<table border=1 bordercolor=000000><tr>"
            else
            not_CSA_CzechAirlines = true
            response.write "<table><tr><td>" ' border=1 bordercolor=#000000
            end if
        
        end if
        %> 
        <%=fix_characters(rulexml.selectnodes("rules").item(0).selectnodes("fare_rule_lines").item(a).selectnodes("content").item(0).text)%>
        <%
        ' if there is no end table tag then create one to end the table
        if right(rulexml.selectnodes("rules").item(0).selectnodes("fare_rule_lines").item(a).selectnodes("content").item(0).text,18) <> "</td></tr></table>" then
        response.write "</td></tr></table>"
        end if 
        %>
        </textarea>
      </div></td>
    </tr>
    <% 'end if %>
    <tr bgcolor="#000000" height="3">
      <td colspan="3"></td>
    </tr>

  
 
<%
Set rs = con.Execute("select Max(RuleSeq) Ref from farerulelines where RuleId = '" &trim(request.form("contract_id"))& "' and CompanyId='"& comp_code &"'")
            'response.write "Ref = " & rs("Ref") & "<br>" 
            If isNull(rs("Ref")) Then
                iMaxKeyRef = 0
            Else
                iMaxKeyRef = CLng(rs("Ref"))
            End If
            iMaxKeyRef = iMaxKeyRef + 1
            fare_id = right("0000" & iMaxKeyRef, 4)     

'if count_rows = 0 then
set rs=con.execute("insert farerulelines (RuleId, RuleSeq, CompanyId) values ('" & trim(request.form("contract_id")) & "', '" & fare_id & "'  , '"& comp_code &"' )")
'response.Write ("insert farerulelines (RuleId, RuleSeq, CompanyId) values ('" & trim(request.form("contract_id")) & "', '" & fare_id & "'  , '"& comp_code &"' )")&"<br>"
set rs1=con.Execute ("update farerulelines set Heading = '"&fix_characters(request.form("heading"&a))&"', Content = '"&fix_characters(request.form("content"&a))&"' where RuleId='" & trim(request.form("contract_id")) & "' and RuleSeq ='" & fare_id & "' and CompanyId ='"& comp_code &"'")
'response.Write ("update farerulelines set Heading = '"&fixquotes(request.form("heading"&a))&"', Content = '"&fixquotes(request.form("content"&a))&"' where RuleId='" & trim(request.form("contract_id")) & "' and RuleSeq ='" & fare_id & "' and CompanyId ='"& comp_code &"'")
'end if
next 
' main loop
%>
 
    <tr>
      <td align="center" colspan="10">
      <div align="center">   
      <input type="hidden" name="show_extras" id="show_extras" value="no">    
<input type="submit" name="Submit" value="Submit" onmouseover="style.cursor='hand'">
<!-- onClick="<%'=response.Write("test")%>"-->
      </div></td>
    </tr>
    <% if show_extras = "no" then %>
    <tr>
      <td colspan="10">
      <div align="center">       
<a href="fareloaderrules_edit.asp?contract_id=<%=trim(request.Form("contract_id"))%>">VIEW</a>
      </div></td>
    </tr>
    <% end if %>
      </table>


www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: richard.york Reply Date: 5/20/2005 10:06:39 AM
How do you do what? This question is too open-ended!

As to the alignment inquiry, honestly it helps to see the output of the script.  Currently we can only guess what's happening there. You can post what you think is the relevant  server-side code till you're blue in the face, and that won't change the fact that it could be things outside of the textarea that are affecting its alignment.

As to populating the textarea, if validation matters to you, output the table to a div like so:

<div id='markup' style='display: none;'>
<!-- ASP generated content goes here -->
</div>
<textarea id='whatever_name' name='whatever_name'></textarea>
<script type='text/javascript'>
     // Populate the textarea with the contents of the div.
     document.getElementById('whatever_name').value = document.getElementById('markup').innerHTML;
</script>


> Can someone tell me where i can find that character on the keyboard?

That looks like a Microsoft Word generated "smart-quotes" apostrophe, which does not inhabit standard ASCII. Turn off the "smart quotes" feature of Word to eliminate that (Tools -> AutoCorrect Options-> AutoFormat As You Type).

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply By: richard.york Reply Date: 5/20/2005 10:12:26 AM
Ah, never mind found it.

right single quote mark              92   #146;         &rsquo;    --> ’
http://www.bbsinc.com/iso8859.html

(still a Microsoft added character though, and best to avoid)

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply By: crmpicco Reply Date: 5/24/2005 5:33:29 AM
how can i get my IP to allow you to view it then?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 5/24/2005 6:29:08 AM
thanks for all your help so far BTW

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 5/25/2005 7:01:11 AM
i have IIS running, do you still ewant to view the output richard?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: richard.york Reply Date: 5/25/2005 8:35:26 AM
> i have IIS running, do you still ewant to view the output richard?

You'll have to post an IP or URL. Then I'll decide if I still want to view it.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply By: crmpicco Reply Date: 5/25/2005 9:02:35 AM
do i run ipconfig?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 5/26/2005 8:14:07 AM
unfortunately, i still seem to be confused with this one. is there a way i can get my IP for YOU to see.

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 6/3/2005 6:13:08 AM
in my IE i get localhost\Fares\fareloader_original.asp

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 6/9/2005 7:59:21 AM
if i got to http://localhost/fares/fareloaderrules_original.asp i get the page, but how do i get my IP to show you the output?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply By: crmpicco Reply Date: 6/14/2005 8:26:01 AM
can i upload a file to the forum?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt

Go to topic 29544

Return to index page 86
Return to index page 85
Return to index page 84
Return to index page 83
Return to index page 82
Return to index page 81
Return to index page 80
Return to index page 79
Return to index page 78
Return to index page 77