I have a chained select box that I would like to load the first time into an application. It''s basic, a selection from box A will load box B. I''m trying to use this but getting different errors. Event.observe(window, ''load'', loadCustomerBox() ); Q: Does this script need to be in the <head> tag? My header is being built by a program I use in all of my applications and this could cause an issue. Q: Is there some other way to achieve this? I tried <body onload> but that didn''t work in IE7 like it did in Safari and Mozilla. Go figure! --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
The error I''m getting in IE7 is: "handler is null or not an object". In Mozzilla it points out this line: "handler.call(element, event)" --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Event.observe expects function as a third parameter, which will be
used as an event handler. It means that your snippet will not work
unless loadCustomerBox (which is executed right away) returns another
function. What you probably meant is:
Event.observe(window, ''load'', loadCustomerBox);
A: This could be used in a <head> or anywhere else, as it simply
attaches observer to a window (i.e. doesn''t care if DOM is ready or
not)
A: Another way would be to use custom ''dom:loaded'' [1] event
which
document fires when the DOM is ready:
document.observe(''dom:loaded'', someHandler);
[1] http://www.prototypejs.org/api/document/observe
Best,
kangax
On Feb 29, 10:11 pm, mjhaston
<mich...-H9i9S/IRogJ7tPAFqOLdPg@public.gmane.org>
wrote:> The error I''m getting in IE7 is: "handler is null or not an
object".
>
> In Mozzilla it points out this line: "handler.call(element,
event)"
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
You nailed it. It''s working! Thanks a bunch. I''ll check into the document.observe as well. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---