Please Help!!!

Discussion in 'Javascript' started by Iyke, Jan 26, 2004.

  1. Iyke

    Iyke Guest

    I am having a mouse scroll wheel problem with my select drop downs.
    whenever a user uses the scroll wheel to adjust the quatity of items
    is a cart, I currently use the onChange() function to submit the form
    to a JavaCode that updates my cart. This breaks my code when the user
    scrolls quickly with the wheel. I am trying to submit the Form only
    ones using a javascript function. So onChange(), I call the follwing
    function:

    function changing(){
    newCount = 0;
    SubmitCount++;//global variable
    newCount = SubmitCount;
    this.setTimeout("submitForm(newCount)", 1000);
    }

    function submitForm(nc){

    if (nc == SubmitCount){
    document.cart.submit();
    }
    }

    I was hoping the setTimeout function will act as wait() or sleep(),
    and that each change with the scroll wheel will increase the
    SubmitCount variable and set newCount to SubmitCount, so whenever a
    change wakes up from the setTimeout function, newCount will not equal
    submitCount. The only time they should be equal is with the last
    change sent to the function. But this does not work well because
    newCount for the first request and last request are always identical.
    Does anyone have any suggestions?

    Thanks..
    Iyke.
     
    Iyke, Jan 26, 2004
    #1
    1. Advertising

  2. On 26 Jan 2004 05:46:00 -0800, Iyke <> wrote:

    > I am having a mouse scroll wheel problem with my select drop downs.
    > whenever a user uses the scroll wheel to adjust the quatity of items
    > is a cart, I currently use the onChange() function to submit the form
    > to a JavaCode that updates my cart. This breaks my code when the user
    > scrolls quickly with the wheel. I am trying to submit the Form only
    > ones using a javascript function. So onChange(), I call the follwing
    > function:


    <snipped code>

    > I was hoping the setTimeout function will act as wait() or sleep(),
    > and that each change with the scroll wheel will increase the
    > SubmitCount variable and set newCount to SubmitCount, so whenever a
    > change wakes up from the setTimeout function, newCount will not equal
    > submitCount. The only time they should be equal is with the last
    > change sent to the function. But this does not work well because
    > newCount for the first request and last request are always identical.
    > Does anyone have any suggestions?


    Performing a form submission on inputs such as menus and checkboxes is
    generally a bad idea. If a user makes a mistake, uses the keyboard for
    navigation, or changes their mind about what they selected, they will have
    no way to select the right option.

    The better idea is to use a button. As you want to execute code upon
    submission, you can call it "onclick". As well as avoiding the above
    issues, you present an interface that the user will be familiar with.
    Clicking a button is associated with performing an action, such as a form
    submission. Selecting an item from a menu is not.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
     
    Michael Winter, Jan 26, 2004
    #2
    1. Advertising

  3. Iyke

    Grant Wagner Guest

    Iyke wrote:

    > I am having a mouse scroll wheel problem with my select drop downs.
    > whenever a user uses the scroll wheel to adjust the quatity of items
    > is a cart, I currently use the onChange() function to submit the form
    > to a JavaCode that updates my cart. This breaks my code when the user
    > scrolls quickly with the wheel. I am trying to submit the Form only
    > ones using a javascript function. So onChange(), I call the follwing
    > function:
    >
    > function changing(){
    > newCount = 0;
    > SubmitCount++;//global variable
    > newCount = SubmitCount;
    > this.setTimeout("submitForm(newCount)", 1000);
    > }
    >
    > function submitForm(nc){
    >
    > if (nc == SubmitCount){
    > document.cart.submit();
    > }
    > }
    >
    > I was hoping the setTimeout function will act as wait() or sleep(),
    > and that each change with the scroll wheel will increase the
    > SubmitCount variable and set newCount to SubmitCount, so whenever a
    > change wakes up from the setTimeout function, newCount will not equal
    > submitCount. The only time they should be equal is with the last
    > change sent to the function. But this does not work well because
    > newCount for the first request and last request are always identical.
    > Does anyone have any suggestions?
    >
    > Thanks..
    > Iyke.


    Yes, I have a couple:

    1) use a more descriptive subject then "Please Help!!!", you are more
    likely to receive a response to your inquiry

    2) don't use the changing of a drop-down menu to trigger the submission
    of a form, use a button. Instead of trying to hack around the way the
    end-user's UI works, just avoid the problem in the first place

    --
    | Grant Wagner <>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    *
    http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

    * Internet Explorer DOM Reference available at:
    *
    http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 7 / Mozilla
    * http://www.mozilla.org/docs/web-developer/upgrade_2.html
     
    Grant Wagner, Jan 27, 2004
    #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. JC
    Replies:
    4
    Views:
    8,005
    Jeff C
    Jul 8, 2004
  2. Replies:
    4
    Views:
    541
    Chris Uppal
    May 5, 2005
  3. KK
    Replies:
    2
    Views:
    646
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,785
    Mike Hewson
    Jan 7, 2005
  5. mera
    Replies:
    7
    Views:
    1,130
Loading...

Share This Page