Solved, using the fantastic event.simulate.js prototype extension.
http://github.com/kangax/protolicious/blob/master/event.simulate.js

On Sep 24, 2:46 pm, uberllama <[email protected]> wrote:
> Hi folks. Been banging my head against the wall for a while on this
> one so figure I'd shoot it out there and see if anyone has insight.
> I'm overriding the document.on("click", "*[data-confirm]",
> function(event, element) method in rails.js, to call a custom dialog
> instead of a straight browser confirm box, like so.
>
>   document.on("click", "*[data-confirm]", function(event, element) {
>         if (!window._confirmed) {
>                 var message = element.readAttribute('data-confirm');
>                 Mylib.confirm(element, message);
>                 event.stop();
>         }
>   });
>
> What this does is load up a javascript dialog with a cancel and okay
> button. If the okay button is clicked, I set window._confirmed to
> true, call an onclick on the original element, then reset
> window._confirmed to false. This worked in Rails 2, since the
> javascript was all inline via an onclick. However I haven't managed to
> re-trigger the click using the Rails 3 UJS method.
>
> Hoping someone has some insight to what's probably a simple issue that
> I just can't see right now. Cheers.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en.

Reply via email to