Hello dear Javascript Gurus,

I have an issue with "overriding" event handlers.

I know that Event.observe only adds event handlers.

 

Lets say I have a form

<form onsubmit="alert('first')" id="f1">

 

And I do not have influence on that -> this onsubmit handler inside the form
API and cannot be changed.

 

What I want to to is to register my own function on the submit

Even.observe('f1','submit', function(evt) { Event.stop(evt); })

 

In this easy case I just want to prevent the submit.

What happens is that first the alert ('first') is executed. After that the
event is stopped.

 

What would be the best way to make sure my observe is called before the
inline code (in this case nothing is alerted).

For me it looks like the inline code is the first that is handled.

Shall I, after adding my handlers, take the code from the inline, put it
into an function, attach it as handler, and remove the inline submit code?

 

Or any other best practices to deal with this?

 

Thanks

.: Fabian


--~--~---------~--~----~------------~-------~--~----~
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