[jifty-devel] Cancel in onclick not working in IE

Andrew Sterling Hanenkamp sterling at hanenkamp.com
Thu Aug 16 16:13:32 EDT 2007


That HTML works correctly for me on IE7, I don't know what's going on to
make it continue even if you click Cancel. Returning false for any event
handler in JavaScript should be enough to stop the default action on
practically any browser that supports JavaScript.

Obviously, something isn't working, but I don't know what it is. Jifty's
doing the right thing here.

I just created a test page empty but for that HTML and it didn't attempt to
jump to the other page after clicking the link when I hit Cancel on the
dialog, but did jump when I hit OK the second time.

On 8/16/07, Henry Baragar <Henry.Baragar at instantiated.ca> wrote:
>
> Andrew,
>
> Thanks for looking into this for me.
>
> On Thursday, August 16 2007 12:24 pm, Andrew Sterling Hanenkamp wrote:
> > Henry,
> >
> > Could you post the generated HTML source containing the submit button?
> That
> > might help.
> >
> > I just checked on Internet Explorer 7 and reconfirmed that confirmation
> is
> > working correctly for me. Are you using IE6 or IE7? I don't have IE6 on
> my
> > laptop, but I can have another guy test IE6 if that's where you're
> having
> > the problem. However, it really should work. The JS code generated by
> Jifty
> > is like this:
> >
> The miniumum version for IE is 7.  I am seeing the failures using IE
> 7.0.5730.11 on Windows XP Professional 2002 SP 2 running in VMWare on
> Linux.
>
> > if(!confirm('Are you sure you wish to cancel any changes?')) {
> > Event.stop(event);
> > return false; }
> >
>
> From IE7:
>
> <a href="/delete/customer_user/3" onclick="if(!confirm('Delete del me?'))
> return false;">Delete</a>
>
> Has the code been changed since 0.704220?
>
> Henry
>
> > The "return false" is the best (pretty much universally) supported
> solution
> > for stopping the default submit behavior. However, Jifty goes ahead and
> > uses Event.stop(event) just to be extra thorough. However, if it's not
> > working for you, the HTML should show the problem.
> >
> > Cheers,
> > Andrew
> >
> > On 8/16/07, Henry Baragar <Henry.Baragar at instantiated.ca> wrote:
> > > Hello all,
> > >
> > > Has anyone else observed a problem with IE where the Cancel button on
> a
> > > confirmation box acts as a "OK" button and causes the action to be
> > > executed?
> > >
> > > I have in my code:
> > >
> > > Jifty->web->link(
> > >           label => "Delete",
> > >           url   => "/delete/customer_user/$seq",
> > >           onclick       => {confirm => "Delete $name?"},
> > >         )
> > >
> > > This code works as expected in Firefox and Opera.  But in IE, the
> action
> > > is
> > > executed (ie. the user is deleted) regards of what the user does.
> > >
> > > Does anybody know why this is happening in IE?  Does anyone know of a
> fix
> > > or a
> > > work around?
> > >
> > > Regards,
> > > Henry
> > > _______________________________________________
> > > jifty-devel mailing list
> > > jifty-devel at lists.jifty.org
> > > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20070816/72117a41/attachment.htm


More information about the jifty-devel mailing list