Hi Justin,

>You should not be attempting to attach events to elements that are not on the 
>page

The code is in an external .js file and there are only a couple of
pages where that element doesn't appear.

>var elem = $('frm');

I guess I can't do that though as $('frm') won't exist and throw an
error. Remember that this code exists in the 'onload' code block.



On Jan 23, 4:49 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> On Jan 22, 2008 11:13 PM, Michael Sharman <[EMAIL PROTECTED]> wrote:
>
> > This is working great
> > except certain elements aren't available on all pages so their causing
>
> You should not be attempting to attach events to elements that are not
> on the page, Prototype is not a "fail silently" framework.
>
> I usually do something like your above code, except I would fetch the
> element once to avoid multiple $() calls, such as:
>
> var elem = $('frm');
> if (elem) elem.observe('submit', handler);
>
> -justin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to