Results 1 to 3 of 3

Thread: a drop down menu html field how to limit it's size to eg 15 characters [HORIZONTALLY

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default a drop down menu html field how to limit it's size to eg 15 characters [HORIZONTALLY

    a drop down menu html field how to limit it's size to eg 15 characters [HORIZONTALLY] ? Vertically be size="1" ...

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    This might be helpful:
    http://www.webmasterworld.com/html/3018783.htm

    Good luck!

  3. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Or if your using PHP:
    PHP Code:
    $selects = array('Dogs''Cats''Tigers''Hippopotamus');
    function 
    select($array$name$limit 5$etc true$shorten_val false){ //select( array_name , select_name, [limit], [display: ... after cutted], [shorten the value of the option])
      
    $select "<select name='{$name}'>\n";
      foreach(
    $array as $value){
        
    $display_val strlen($value) > $limit substr($value0$limit).($etc "..." "") : $value;
        if(
    $shorten_val){ $value $display_val; }
        
    $select .= "<option name='{$value}'>{$display_val}</option>\n";
      }
      
    $select .= "</select>\n";
      return 
    $select;
    }
    echo 
    select($selects'type'5truefalse); 
    Tell me if you need a commented version.
    Last edited by Nile; 01-25-2009 at 11:37 PM.
    Jeremy | jfein.net

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
  •