SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict
    Join Date
    May 2001
    Location
    hong kong
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    input text field

    As you can see, this is the html for the text fied
    <td align="right"><input type="text" name="say" maxlength="700" accesskey="x" style="width: 220px">
    seemingly, the number of words written in is fixed...
    So, how can I write as many words as possible that the end of sentence not being chopped and the size of the field(that box appearence) do not change

    or the field is controlled by the style??

    thanks...

  2. #2
    SitePoint Zealot 19nine78's Avatar
    Join Date
    Feb 2002
    Location
    Ayr, scotland
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The number of words which can be entered into the field is dictated by the 'maxlength' attribute. If you want a field with no limits, just leave it out.

    eg:

    <input type="text" name="say" accesskey="x" style="width: 220px">

    The style attribute only sets the width that the box will appear on screen, which can also be set using 'size' attribute however the size attribute sets the width of the box in characters, not pixels.

    cheers

    alastair

  3. #3
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The way you have it, the width controls the overall physical size of the input field and maxlength controls how many characters can be entered into the box.

    The sentences are only being cut off when the user reaches the limit of 700 characters. To increase the amount you want to allow them to write, increase the maxlength value, to increase the width, increase the width value.

    They can write up to 700 characters in the box, the box just scrolls as the do so to show them what they are currently typing.

    I dont really understand as you seem to have the solution for you problem in the code you already have.

    Glen

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you set maxlength then the fixed length of the field is 700 characters(in your case). If you set size, that's what sets the appearance of the <input>.

    For instance.
    Code:
    <input name="field" size="50" maxlength="350">
    simply puts a text field that appears to be 50 characters wide but it will scroll, and scroll, and scroll until you get to 350 characters.

    Good luck.
    Sketch
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Addict
    Join Date
    May 2001
    Location
    hong kong
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think there is no problem on the form and I doubt the style.... here is the style..
    any clues??

    As this is the form and may be the script chop the length of the say.....I will check...so here is the style


    <style type="text/css">
    <!--
    .title { font-weight: bold; color: #8899AA; }
    body { scrollbar-face-color: #262626; scrollbar-3dlight-color: #262626; scrollbar-highlight-color: #262626; scrollbar-shadow-color: #262626; scrollbar-darkshadow-color: #262626; scrollbar-track-color: #1A1A1A; scrollbar-arrow-color: #8899AA; }
    hr { color: #333333; height: 1px; }
    input { font-family: Verdana; font-size: 10px; color: #8899AA; text-decoration: none; background-color: #1A1A1A; border-color: #4A4A4A; border-style: solid; border-width: 1px; }
    td { font-family: Verdana; font-size: 10px; color: #888888; text-decoration: none; }
    a:active { color: #AAAAAA; text-decoration: none; }
    a:hover { color: #8899AA; text-decoration: none; }
    a:link { color: #AAAAAA; text-decoration: none; }
    a:visited { color: #666666; text-decoration: none; }
    -->
    </style>
    Last edited by uatt; May 11, 2002 at 06:57.

  6. #6
    SitePoint Addict
    Join Date
    May 2001
    Location
    hong kong
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, it is substring funtion to chop the words...

    now I got a new problem..

    the sentence do not wrap...and it enlarge my table of the page

    what part in html should I add it to make the sentence wrapping to next line and not widen my table...

  7. #7
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you're referring to continuous sentences with no spaces in between not wrapping and extending your table, i *think* there's no solution for that by changing the HTML alone... you can do that with PHP, ASP, Perl (i.e. server-side scripts)

  8. #8
    SitePoint Addict
    Join Date
    May 2001
    Location
    hong kong
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so how it compose in perl..
    is it work...

    $index = 30 ;
    $len =length($say);
    if($len > 30){ $say = subsrt($say, 0, 30)."<br>\n".substr($say, 31, $len+1) ;

  9. #9
    SitePoint Enthusiast
    Join Date
    May 2002
    Location
    Westborough, Massachusetts
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by redemption
    if you're referring to continuous sentences with no spaces in between not wrapping and extending your table, i *think* there's no solution for that by changing the HTML alone...i.e. server-side scripts)
    This wraps text in my forms!
    Code:
    <textarea wrap=virtual rows=10 cols=50 name="Questions_Comments"></textarea>
    I hope that helps.
    "Living life in the fun lane!"

  10. #10
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but it doesn't wrap text in tables


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •