cgi.pm popup_menu define select width?

Discussion in 'Perl Misc' started by inetquestion, Mar 27, 2005.

  1. inetquestion

    inetquestion Guest

    Is it possible to define the width of a select menu using cgi.pm such
    as shown below?

    TIA,

    -Inet


    <select name="myselect" class="textfield" width="130" style="width:
    130px;">
    <option></option>
    <option></option>
    <option></option>
    <option></option>
    <option></option>
    </select>
    inetquestion, Mar 27, 2005
    #1
    1. Advertising

  2. inetquestion wrote:
    > Is it possible to define the width of a select menu using cgi.pm such
    > as shown below?
    >
    > <select name="myselect" class="textfield" width="130" style="width:
    > 130px;">


    CGI.pm seems to acknowledge an undocumented -width parameter. However,
    if it ever was valid HTML to use the "width" attribute in "select"
    elements, I suppose it's at least deprecated.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Mar 27, 2005
    #2
    1. Advertising

  3. inetquestion

    inetquestion Guest

    the part I'm was referring to specifically is: style="width: 130px;"

    as this sets the minimum width whereas the other specifies the maximum
    width.
    inetquestion, Mar 27, 2005
    #3
  4. inetquestion wrote:

    > the part I'm was referring to specifically is: style="width: 130px;"


    What happened when you tried passing a style argument to popup_menu?
    Brian McCauley, Mar 27, 2005
    #4
  5. inetquestion wrote:
    > the part I'm was referring to specifically is: style="width: 130px;"


    The -style parameter is described in the CGI.pm POD, and I couldn't
    imagine that you asked hundreds of programmers for help to read the docs
    for you.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Mar 28, 2005
    #5
  6. Gunnar Hjalmarsson wrote:
    > inetquestion wrote:
    >
    >> Is it possible to define the width of a select menu using cgi.pm such
    >> as shown below?
    >>
    >> <select name="myselect" class="textfield" width="130" style="width:
    >> 130px;">

    >
    >
    > CGI.pm seems to acknowledge an undocumented -width parameter. However,
    > if it ever was valid HTML to use the "width" attribute in "select"
    > elements, I suppose it's at least deprecated.
    >


    In fact CGI.pm seems to tacitly accept most any parameter, presumably in
    the spirit of flexibility. For instance,

    print $q->popup_menu(-name=>'myselect', -foo=>'bar');

    will generate

    <select name="myselect" foo="bar">
    </select>

    So to produce what the OP is asking for you would want to do something like

    print $q->popup_menu(-name=>'myselect', -class=>'textfield',
    -width=>'130', -style=>'width: 130px;');

    Specifying the width via CSS is valid, but "width" as an HTML attribute
    for <SELECT> is totally bogus.
    Andras Malatinszky, Mar 28, 2005
    #6
  7. On Sun, 27 Mar 2005, Andras Malatinszky wrote:

    > In fact CGI.pm seems to tacitly accept most any parameter,
    > presumably in the spirit of flexibility. For instance,
    >
    > print $q->popup_menu(-name=>'myselect', -foo=>'bar');
    >
    > will generate
    >
    > <select name="myselect" foo="bar">


    Indeed; and this is CGI.pm's trick for supporting attributes which
    aren't explicitly known. But it means that acceptance by CGI.pm is
    absolutely no guarantee of meaningfulness as far as HTML is concerned
    (which I'm sure was the point you were intending to make here)

    > Specifying the width via CSS is valid, but "width" as an HTML
    > attribute for <SELECT> is totally bogus.


    Completely OT for Perl, but google suggests
    http://www.blooberry.com/indexdot/html/topics/selectwidth.htm
    which looks quite a sensible analysis of the issue, it its way.
    Alan J. Flavell, Mar 29, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    744
    Bruce Barker
    Oct 10, 2005
  2. Eric Schwartz
    Replies:
    0
    Views:
    110
    Eric Schwartz
    Dec 2, 2003
  3. Mallory Cloutier
    Replies:
    1
    Views:
    86
    Mallory Cloutier
    Aug 26, 2008
  4. Emil Tarazi

    CGI.pm popup_menu questions

    Emil Tarazi, Jun 7, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    159
    Brian McCauley
    Jun 7, 2004
  5. John
    Replies:
    6
    Views:
    233
    robic0
    Apr 14, 2006
Loading...

Share This Page