form help

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

    form help

    I have a form with a dropdown menu and I want to make sure that people
    have clicked on something. I have a NA one at the bottom but I want an
    error to popup if they dont move it from its default value

    Thanks
    Matt
  • kaeli

    #2
    Re: form help

    In article <YdfLb.22527$P% 1.21622372@news svr28.news.prod igy.com>,
    matthusby@hotma il.com enlightened us with...[color=blue]
    > I have a form with a dropdown menu and I want to make sure that people
    > have clicked on something. I have a NA one at the bottom but I want an
    > error to popup if they dont move it from its default value
    >
    > Thanks
    > Matt
    >[/color]

    Put the default at the top, then check for selectedIndex being greater
    than 0.

    --
    --
    ~kaeli~
    Murphy's Law #3020: Quality assurance doesn't.



    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: form help

      matt wrote:
      [color=blue]
      > I have a form with a dropdown menu and I want to make sure
      > that people have clicked on something.[/color]

      You cannot make it sure. Client-side scripting can be disabled
      or not even supported. Server-side checking is required anyway,
      but you can reduce round trips with client-side checking.
      [color=blue]
      > I have a NA one at the bottom[/color]

      ?
      [color=blue]
      > but I want an error to popup if they dont move it from its
      > default value[/color]

      function checkMe(oForm)
      /**
      * @param oForm
      * Reference to the HTMLFormElement object to be checked.
      * @returns
      * <code>true</code> if validation is passed,
      * <code>false</code> otherwise (and thus canceling the event).
      */
      {
      if (/* any form control has its default value */)
      {
      alert(...);
      // ...
      return false;
      }
      return true;
      }

      <form ... onsubmit="retur n checkMe(this)" ...>
      ...
      </form>


      HTH

      PointedEars

      Comment

      Working...