I've found out the cause of the problem, but not the solution yet. But
having written this post has helped me understood that I shouldn't be
using window.onload anymore. :)
Hope I can get some advice for the problem though.. turns out it was
because I was sharing the same js throughout 3 pages.
Song Page -> contains rating form only
Comment Page -> contains rating and comment form
Tellfriend Page -> contains rating and tellfriend form
So I realized the problem is consistant with the order in which the
functions are called.
$('rating').onsubmit = function () {
rateit();
return false;
}
$('form_tell').onsubmit = function () {
tellfriend();
return false;
}
$('form_comment').onsubmit = function () {
comment();
return false;
}
would work for the Song and Tellfriend Page, but for comments page
because form_tell doesn't exist, it will crash.
Question is how should I go about this? Should I simply make a
different js for the different pages since the code is so minimal
anyway or is there a another way ?
Thanks for your time...
On Jan 8, 10:20 pm, bflanagan <[email protected]> wrote:
> Try this:
> Replace this:
> window.onload = function(){
> ...
>
> }
>
> with:
> Event.observe(window,"load",function(){
> ...
>
> });
>
> If the issue persists, then verify that the third form (I assume it's
> #form_comment) is rendered to the page during the load process and not
> loaded by some other post-load event. Also, make sure that the id of
> the form really is 'form_comment' (could be as simple as a typo).
>
> Brian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---