associate a hidden input to (chosen) select option in form?

Discussion in 'HTML' started by Quasimido CSS, Nov 7, 2005.

  1. <form action="http://www.mmmm.org/cgi-bin/search" method="get">
    <input name="yyyyyy" value="1" type="hidden">
    <input name="query" size="50" value="">
    <select name="zzzzzz">
    <option value="888">YOU-WANT-THIS</option>
    <option value="899" selected="selected">OR-KEEP-THIS</option>
    <option value="999">OR-CHOOSE-THIS</option>
    </select>
    </form>

    i'd like
    to convert input name="yyyyyy" to a select name="yyyyyyy" (or whatever that can have
    more than one value assigned) that is
    1 also chosen when user chooses the select name="zzzzzz" option.
    2 still hidden (this isn't terribly important, though)

    so this
    <input name="yyyyyy" value="1" type="hidden">

    would instead look something like
    <select name="yyyyyy">
    <option value="1">1 but you can't see this</option>
    <option value="2">2 but you can't see this</option>
    <option value="3">3 but you can't see this</option>
    </select>

    except it would actually look like whatever would work :)

    unless this is impossible? or possible only with script?

    ------
    googling the likes of
    http://groups.google.com/groups?q=select name options ~tied form html
    associated multiple two-options
    gave optgroup or less likely answers

    tia...
    Quasimido CSS, Nov 7, 2005
    #1
    1. Advertising

  2. Quasimido CSS

    Safalra Guest

    Quasimido CSS wrote:
    > i'd like
    > to convert input name="yyyyyy" to a select name="yyyyyyy" (or whatever that can have
    > more than one value assigned) that is
    > 1 also chosen when user chooses the select name="zzzzzz" option.
    > 2 still hidden (this isn't terribly important, though)


    You can hide a select element using CSS (display:none;), but obviously
    that depends on whether the UA supports CSS. It might be a better idea
    to tell us why exactly you want to do this, and then we could propose
    better solutions.

    --
    Safalra (Stephen Morley)
    http://www.safalra.com/hypertext/
    Safalra, Nov 7, 2005
    #2
    1. Advertising

  3. "Safalra" <> in news:1131381265.601069.118530
    @f14g2000cwb.googlegroups.com:

    > Quasimido CSS wrote:
    >> i'd like
    >> to convert input name="yyyyyy" to a select name="yyyyyyy" (or whatever that can

    have
    >> more than one value assigned) that is
    >> 1 also chosen when user chooses the select name="zzzzzz" option.
    >> 2 still hidden (this isn't terribly important, though)

    >
    > You can hide a select element using CSS (display:none;), but obviously
    > that depends on whether the UA supports CSS.


    there's a simple solution to the 2nd part, thanks

    inspired me to try type="hidden" in <select.. > and in <option ..>
    but as expected, (because it wouldnt make sense to hide a choice) that had no effect.

    > It might be a better idea
    > to tell us why exactly you want to do this, and then we could propose
    > better solutions.


    end goal?
    i have copies of various site forms jammed onto my browser homepage (since i'm
    submitting to websites, i cannot change the cgi whatever on those websites servers)

    in the case of this site,
    Essentially the visitor selects yyyyyy by going to that webpage. yyyyyy has only a few
    values, and each value is found on only one webpage. the site use a unique option
    values for each zzzzzz no matter the page, but their cgi-whatever groups a bucnh of
    zzzzz values with each yyyyyy input.

    when testing values in the url, i discovered that thier cgi-whatever ignores or blocks
    values of zzzzzz that aren't associated with the yyyyyy value in the url

    eg, either:
    mixnmatch causes weirdness.
    www.site.com/search?yyyyyy=sheep&zzzzzz=gills
    doesn't return any search results
    or
    when i chose the yyyyyy="0" value (it exists normally when zzzzzz is also
    unspecified)
    www.site.com/search?yyyyyy=0&zzzzzz=gills
    it shows good search results, but the page hides the select option to choose a different
    zzzzzz

    the goal of my html:
    i use only a few zzzzzz. so i'd like to put them in just one pulldown (select). i'm trying
    to avoid having to go to each page, just to change the change the value of yyyyyy in
    order to see my newly chosen zzzzzz.

    in terms of the critter parts examples, I want to select zzzzzz=gills using the pulldown,
    and have yyyyyy=fish be 'automatically' associated or tied to my zzzzzz select, before
    the form submits to the site:
    www.site.com/search?yyyyyy=fish&zzzzzz=gills
    choose fins:
    www.site.com/search?yyyyyy=fish&zzzzzz=fins
    choose baaaaahh:
    www.site.com/search?yyyyyy=sheep&zzzzzz=baaaaahh
    Quasimido CSS, Nov 7, 2005
    #3
    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. Michelle Stone
    Replies:
    0
    Views:
    410
    Michelle Stone
    Oct 15, 2003
  2. Replies:
    0
    Views:
    424
  3. Replies:
    0
    Views:
    3,395
  4. Skip Montanaro

    Propagating poorly chosen idioms

    Skip Montanaro, Apr 5, 2005, in forum: Python
    Replies:
    3
    Views:
    262
    Roy Smith
    Apr 6, 2005
  5. Replies:
    1
    Views:
    246
    Ben Finney
    Oct 23, 2006
Loading...

Share This Page