Dynamic SELECT dropdown box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ganco

    Dynamic SELECT dropdown box

    We have a dropdown combobox, where some of the text is wider than the
    textarea.
    I cannot set the width of the SELECT any higher due to design
    restrictions on the company website.

    When clicking the dropdown box, I want the textarea (which unfolds
    beneath the dropdown) to expand to the widest element of the options.
    I can see that Netscape does this automatically, but how would you do
    it in IE?

    thanks beforehand
    Greg
  • Thomas 'PointedEars' Lahn

    #2
    Re: Dynamic SELECT dropdown box

    Ganco wrote:
    [color=blue]
    > We have a dropdown combobox, where some of the text is wider than
    > the textarea.
    > I cannot set the width of the SELECT any higher due to design
    > restrictions on the company website.[/color]

    What if CSS is disabled or not even supported? The design is definitely
    borken.
    [color=blue]
    > When clicking the dropdown box, I want the textarea (which unfolds
    > beneath the dropdown)[/color]

    When one writes about a textarea here, it is most certainly considered
    a `textarea' (X)HTML element. In this regard, it is not a textarea
    that unfolds but a list of options, because it is only displayed as a
    dropdown box in *your* UA(s), it is in fact a `select' element of size 1.
    [color=blue]
    > to expand to the widest element of the options.
    > I can see that Netscape does this automatically,[/color]

    IE (6.0) does it, too, unless you specify the width of the `select'
    element with CSS.
    [color=blue]
    > but how would you do it in IE?[/color]

    If you need the fixed width of the element there is no way to accomplish
    that. Even if you could do that with JScript[tm] somehow, what if
    script support is disabled? Even if you would use an ActiveX control
    that allows that rather than the HTML element, what if ActiveX support
    is disabled or not present (AFAIK all UAs but IE on Windows)? You
    cannot fix design flaws in other ways (including JavaScript) reliably
    instead of really *fixing* them.


    PointedEars
    --
    The last words of an *n*x admin:
    # fsck /dev/hda8
    /dev/hda8 ist already mounted. Destroy directory structure anyway?<y> yes
    Please stand by...

    Comment

    • Gregers A. H. Hovmand

      #3
      Re: Dynamic SELECT dropdown box

      Thanks alot for your help sofar, Thomas.

      You are right: it is not a textarea, but a list of options which unfolds.

      We have CSS enabled, however there are no specific attributes for the SELECT
      apart from the one we are inlining (width=110px).

      I have tried to take out the 'width' of the SELECT element, however to no
      avail. The dropdown just expands to the widest element. This is not allowed
      (we have a restriction of max 110px for a dropdown on that specific page).
      We want the list of options to expand. Do you possibly have a code snip I
      could look at, which does the trick?

      We are not allowed to use ActiveX or anything similar, just JScript or
      javascript.
      When script is disabled, it is not a problem (we use complete different page
      renedering logic)


      "Thomas 'PointedEars' Lahn" <PointedEars@we b.de> wrote in message
      news:3FD51009.4 050405@PointedE ars.de...[color=blue]
      > Ganco wrote:
      >[color=green]
      > > We have a dropdown combobox, where some of the text is wider than
      > > the textarea.
      > > I cannot set the width of the SELECT any higher due to design
      > > restrictions on the company website.[/color]
      >
      > What if CSS is disabled or not even supported? The design is definitely
      > borken.
      >[color=green]
      > > When clicking the dropdown box, I want the textarea (which unfolds
      > > beneath the dropdown)[/color]
      >
      > When one writes about a textarea here, it is most certainly considered
      > a `textarea' (X)HTML element. In this regard, it is not a textarea
      > that unfolds but a list of options, because it is only displayed as a
      > dropdown box in *your* UA(s), it is in fact a `select' element of size 1.
      >[color=green]
      > > to expand to the widest element of the options.
      > > I can see that Netscape does this automatically,[/color]
      >
      > IE (6.0) does it, too, unless you specify the width of the `select'
      > element with CSS.
      >[color=green]
      > > but how would you do it in IE?[/color]
      >
      > If you need the fixed width of the element there is no way to accomplish
      > that. Even if you could do that with JScript[tm] somehow, what if
      > script support is disabled? Even if you would use an ActiveX control
      > that allows that rather than the HTML element, what if ActiveX support
      > is disabled or not present (AFAIK all UAs but IE on Windows)? You
      > cannot fix design flaws in other ways (including JavaScript) reliably
      > instead of really *fixing* them.
      >
      >
      > PointedEars
      > --
      > The last words of an *n*x admin:
      > # fsck /dev/hda8
      > /dev/hda8 ist already mounted. Destroy directory structure anyway?<y> yes
      > Please stand by...[/color]


      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Dynamic SELECT dropdown box

        Gregers A. H. Hovmand wrote:
        [color=blue]
        > I have tried to take out the 'width' of the SELECT element, however
        > to no avail. The dropdown just expands to the widest element. This is
        > not allowed (we have a restriction of max 110px for a dropdown on
        > that specific page).[/color]

        That restriction ignores the basics of the used medium.
        [color=blue]
        > We want the list of options to expand. Do you possibly have a code
        > snip I could look at, which does the trick?[/color]

        You cannot do that in other ways than I already suggested.
        It is the user agent that renders the element, not CSS or
        JavaScript. Complain to M$.
        [color=blue]
        > [Top post][/color]

        Please trim your quotes and place the answer *below* the "question".


        PointedEars

        Comment

        • Gregers A. H. Hovmand

          #5
          Re: Dynamic SELECT dropdown box

          > That restriction ignores the basics of the used medium.

          Do not understand this statement
          [color=blue]
          > You cannot do that in other ways than I already suggested.
          > It is the user agent that renders the element, not CSS or
          > JavaScript. Complain to M$.[/color]

          It is actually the OS which renders this element, not the UA.
          Don't understand your suggestion from your last post.
          Checked in VB, and it is not possible to do this either.
          Maybe one should write code to access the WinAPI to do this? who knows?
          [color=blue]
          > Please trim your quotes and place the answer *below* the "question".[/color]

          OK

          Greg


          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Dynamic SELECT dropdown box

            Please include a short attribution line like the below one so one
            can see who wrote what you are referring to, even if the posting
            expired.

            Gregers A. H. Hovmand wrote:

            [Quote completed]
            [color=blue]
            > Thomas 'PointedEars' Lahn wrote:[color=green]
            >> Gregers A. H. Hovmand wrote:[color=darkred]
            >>> [...]
            >>> (we have a restriction of max 110px for a dropdown on
            >>> that specific page).[/color]
            >>
            >> That restriction ignores the basics of the used medium.[/color]
            >
            > Do not understand this statement[/color]

            For one part, (X)HTML is a markup language, not a layout language.
            CSS is not a layout language either, but a formatting language
            which applies formatting rules to markup elements.

            For another, display of a (X)HTML document depends on the client
            hardware and its user agent software. Unless you can *guarantee*
            that the document is displayed under design conditions, like you
            possibly could if it were an intranet document, never ever assume
            that the document is rendered that way.
            [color=blue][color=green]
            >> You cannot do that in other ways than I already suggested.
            >> It is the user agent that renders the element, not CSS or
            >> JavaScript. Complain to M$.[/color]
            >
            > It is actually the OS which renders this element, not the UA.[/color]

            For IE that is most certainly true. For other UAs it is not, which is
            part of your problem.
            [color=blue]
            > Don't understand your suggestion from your last post.[/color]

            The suggestion was and is that you forget about it and do a complete
            redesign instead because you cannot fix borken design with alternative
            approaches reliably.
            [color=blue]
            > Checked in VB, and it is not possible to do this either.[/color]

            Tough luck.
            [color=blue]
            > Maybe one should write code to access the WinAPI to do this?[/color]

            Maybe, but that has nothing to do with JavaScript at all.


            PointedEars

            Comment

            Working...