On Sep 29, 2:54 am, mhgrove <mhgr...@gmail.com> wrote:
> I want to have the button call a function which first schedules a call
> to show the busy spinner after say like 5 seconds.  This way if the
> call to the server is fast, there's no blip on screen of the spinner
> just before the page redirects.  The function should also defer a call
> to a function which will actually make the call to the server.  And
> when the call is complete, the callback which redirects the page to
> the result should be invoked.

Browsers already have methods that tell the user they are busy, much
better to teach users to recognise that general behaviour than deal
with different behaviours at each site.

[...]

> In any case, putting a "return false;" at the end of the method called
> by the click handler on the form submit button, and then returning
> that value to the form seems to cancel the submission and my code
> works as expected.

I'm not sure what you mean by the above, but submit listeners should
be attached to the form, not the submit button. The inline version is
something like:

 <form onsubmit="return doStuff(this);" ...>

If doStuff returns false, submission is cancelled. If it returns any
other value (even undefined or nul) the form will submit. The listener
can of course be added dynamically using something like:

  form.onsubmit = function() {
    var form = this;

    // do stuff with form, decide whether to cancel submit or not

    if (cancelSubmit) {
      return false;
    } else {
      return whatever;
    }
  }

The key is to use the form's submit event, not the button's click
event.


--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to