The ideal thing to do is to have them chain from one another, so that
one calls the next, rather than setting a delay and hoping the browser
gets the order correct. Take a look at defer() in the Prototype API.
That's basically a way to let the browser breathe between events. If
you're not doing anything that calls an effect, then you can write
your code procedurally within reason, making sure that the browser
pauses to re-connect with all of the DOM elements new and old between
steps. If you are calling any Scripty Effects, then the easiest thing
to do is to use the afterFinish callbacks in a chain. That guarantees
that everything is ready before the next change happens to the page.
Walter
On Sep 23, 2010, at 4:09 AM, Kupido wrote:
This seems to work, but what if I have more than 2 functions and I
want them to be executed in exact order?
My example was just the simpliest case I could think of...
On 22 Set, 23:34, Walter Lee Davis <[email protected]> wrote:
Try adding Protaculous defer or delay to the second call, just to
give
the browser a moment to acknowledge that the newly shown element is
really there.
Form.focusFirstElement.delay(0.1,'my-form');
something like that...
Walter
On Sep 22, 2010, at 10:50 AM, Kupido wrote:
Hi Walter,
your method works fine with Scriptaculous effects, but I keep having
the same problem with the following code:
$('my-form').show(); // not appear, just display
$('my-form').focusFirstElement();
The second function seems to be called when the form is still
hidden,
so the field doesn't get focused... this is just an example of
what I
mean, I can post more examples if you need, even with more than two
functions.
Thanks again for your help.
--
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 [email protected]
.
To unsubscribe from this group, send email to
[email protected]
.
For more options, visit this group
athttp://groups.google.com/group/prototype-scriptaculous?hl=en
.
--
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 [email protected]
.
To unsubscribe from this group, send email to [email protected]
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.