print $query->scrolling_list

Discussion in 'Perl Misc' started by Chris, May 1, 2004.

  1. Chris

    Chris Guest

    I have the following code and am trying to have different values than
    what the user clicks on.

    print $query->scrolling_list (
    -name=>'forsale',
    -value=>['No','Yes'],
    -size=>2
    -multiple=>'false');

    Right now when I view my source in the browser it shows as
    <SELECT NAME="forsale" SIZE=2 FALSE>
    <OPTION VALUE="No">No
    <OPTION VALUE="Yes">Yes
    </SELECT>

    and I need it to be (values below are different)
    <SELECT NAME="forsale" SIZE=2 FALSE>
    <OPTION VALUE="">No
    <OPTION VALUE="s">Yes
    </SELECT>

    How would I change the print $query-> to allow this.

    Thanks,
    Chris
     
    Chris, May 1, 2004
    #1
    1. Advertising

  2. Chris

    Keith Keller Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    In article <>, Chris wrote:
    > I have the following code and am trying to have different values than
    > what the user clicks on.
    >
    > print $query->scrolling_list (
    > -name=>'forsale',
    > -value=>['No','Yes'],
    > -size=>2
    > -multiple=>'false');
    >
    > Right now when I view my source in the browser it shows as
    ><SELECT NAME="forsale" SIZE=2 FALSE>
    ><OPTION VALUE="No">No
    ><OPTION VALUE="Yes">Yes
    ></SELECT>
    >
    > and I need it to be (values below are different)
    ><SELECT NAME="forsale" SIZE=2 FALSE>
    ><OPTION VALUE="">No
    ><OPTION VALUE="s">Yes
    ></SELECT>
    >
    > How would I change the print $query-> to allow this.


    Read the CGI documentation about using -labels.

    - --keith

    - --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (Darwin)

    iD8DBQFAkv6ohVcNCxZ5ID8RAq3UAKCQ/OzVbu6uQEQQ/mCbeHvMK5M3KgCgi7yw
    /cX54sBYILmJN8+kodsbjkc=
    =qHAX
    -----END PGP SIGNATURE-----
     
    Keith Keller, May 1, 2004
    #2
    1. Advertising

  3. Chris

    Bob Walton Guest

    Chris wrote:

    > I have the following code and am trying to have different values than
    > what the user clicks on.
    >
    > print $query->scrolling_list (
    > -name=>'forsale',
    > -value=>['No','Yes'],
    > -size=>2
    > -multiple=>'false');
    >
    > Right now when I view my source in the browser it shows as
    > <SELECT NAME="forsale" SIZE=2 FALSE>
    > <OPTION VALUE="No">No
    > <OPTION VALUE="Yes">Yes
    > </SELECT>
    >
    > and I need it to be (values below are different)
    > <SELECT NAME="forsale" SIZE=2 FALSE>
    > <OPTION VALUE="">No
    > <OPTION VALUE="s">Yes
    > </SELECT>
    >
    > How would I change the print $query-> to allow this.

    ....

    > Chris
    >



    Did you miss the following in perldoc CGI?:


    "The optional sixth argument is a pointer to an associative array
    containing long user-visible labels for the list items (-labels). If not
    provided, the values will be displayed."

    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
     
    Bob Walton, May 1, 2004
    #3
  4. Chris

    Chris Guest

    I found the answer I was looking for. Thanks.

    my %lables = (''=>'No',
    's'=>'Yes');

    print $query->scrolling_list (
    -name=>'for_sale',
    -value=>['','s'],
    -default=>[''],
    -size=>2,
    -multiple=>'false',
    -labels=>\%lables);
     
    Chris, May 1, 2004
    #4
    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. Bad_Kid
    Replies:
    3
    Views:
    3,971
    Shawn H. Mesiatowsky
    Apr 7, 2005
  2. Bryan Shaw

    Lock Print Screen and File Print

    Bryan Shaw, Apr 19, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,982
    Kevin Spencer
    Apr 20, 2005
  3. keto
    Replies:
    0
    Views:
    1,022
  4. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    387
    David Cournapeau
    Dec 30, 2008
  5. William

    "Undefined" in scrolling_list

    William, Jan 20, 2006, in forum: Javascript
    Replies:
    3
    Views:
    80
    Thomas 'PointedEars' Lahn
    Jan 23, 2006
Loading...

Share This Page