Brent,
What about the variety of suggestions in your previous thread? (Also,
why start a new thread when you already have one going on this?)
IIRC, the consensus in the previous thread was that A) It's not
Prototype, and B) It may relate to some session management or some
such on the server.
This may be OT, but from the quoted code I'm a bit surprised that it
works reliably across browsers in the first place. Some browsers need
a moment after an update before you can reliably access the new
elements via the DOM. So I'd probably make the onSuccess handler do
both the loading and the attaching, and attach after a Function#defer
[1], like this:
onSuccess: function(transport) {
loadSelectsForm(transport);
attachSelectsFormObservers.defer();
}
(and no onComplete at all) ...or just put the deferred call to
attachSelectsFormObservers in loadSelectsForm since I assume you
always want to do it. But again, this observation isn't about
observers getting lost after a pause, it's about their not getting
attached at all *sometimes* on some browsers, which isn't the issue
you're reporting so again, apologies if it's OT. (Unless the entire
page has a timed refresh?) Still, though, worth a try.
[1] http://prototypejs.org/api/function/defer
FWIW,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available
On Apr 29, 7:59 pm, BrentNicholas <[email protected]> wrote:
> Hi all,
>
> So I posted about this before but am still having troubles with
> Event.observe flaking out on me after a period of time.
>
> Here's the situation:
>
> The page runs and init's the app with:
> document.observe("dom:loaded", init);
>
> init() fires off: getSelectsForm()
>
> As you can see (below) it loads a page and attaches some observers,
> the page loaded only has three buttons on it (as seen in the
> Event.observe code). They are not of the same names or id's, but do
> share the same css class names. Nothing else is loaded.
>
> Now if I click any button right away things work just fine (List Page,
> Add Page). If I wait about 5 minutes (not pressing any buttons first
> after load) the 'buttonGetProjectsList' will not seem to fire the
> 'getProjectsList' function as registered through the observer. However
> the button 'buttonAddProjectForm' will fire off the 'addProject'
> function. Even if you start using the page right away (everything
> works), then wait 5 minutes, the list button will not work but the
> others will.
>
> The pages loaded by these button do not have any elements of the same
> name or id on them that the ''dsp_ProjSelects.cfm' file had. So there
> should not be any naming conflicts.
>
> Any thoughts on this? I've taken the application and stripped in down
> to just what's needed in a test area and I'm still getting the
> trouble.
>
> function getSelectsForm()
> {
> new Ajax.Request('dsp_ProjSelects.cfm?'+cfSession,
> {
> method: 'get',
> onSuccess: loadSelectsForm,
> onComplete: attachSelectsFormObservers,
> onFailure: function(r) {
> throw new Error( r.statusText );
> }
> }
> );
>
> }
>
> function loadSelectsForm(transport)
> {
> var htmlBlock = transport.responseText;
> Element.update(idSelectsDIV,htmlBlock);
> Form.focusFirstElement('SELECT_FORM');
>
> }
>
> function attachSelectsFormObservers()
> {
> Event.observe('buttonGetProjectsList','click', getProjectsList,
> false);
> Event.observe('buttonAddProjectForm','click', addProject, false);
> Event.observe('buttonClearForm','click', clearSelectsForm, false);
>
> }
>
> Also, environment:
> Win XP (all patches)
> IE 6.0.2900.2180.xpsp.080413-2111
>
> Thanks for your time and effort.
>
> Brent
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---