Degrading Remove Button

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Degrading Remove Button

Joel Turnbull-3

I have a remove button that I'd like to pop a js confirmation dialog.

I'd like the button to degrade so that if js is disabled, the user will be taken to a separate confirmation page, ala the WAComponent confirm:

Here's the closest I've gotten

html submitButton
  onClick: 'return confirm(''Are you sure you wish to remove', aFoo name,'?'')';
  callback: [ self confirm: 'Are you sure you wish to remove', aFoo name,'?' ];
  with: each value

The problem with that is, the result of the js confirmation returning true is the callback, which is another confirmation.

It seems like I need a separate callback to handle the result of the js confim. Is that doable? Any other ideas?

I played around with the WAAsyncComponent onClickCallback: but that didn't seem to do what I expected.

Thanks,
Joel

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Degrading Remove Button

Lukas Renggli
Try something along:

html anchor
     onClick: (html scriptaculous request
        callback: [ self removeItem ];
        confirm: 'Are you sure to remove Foo?';
        return: false);
     callback: [ (self confirm: 'Are you sure to remove?') ifTrue: [
self removeItem ] ];
     with: 'remove'

Lukas

2009/10/2 Joel Turnbull <[hidden email]>:

>
> I have a remove button that I'd like to pop a js confirmation dialog.
>
> I'd like the button to degrade so that if js is disabled, the user will be
> taken to a separate confirmation page, ala the WAComponent confirm:
>
> Here's the closest I've gotten
>
> html submitButton
>   onClick: 'return confirm(''Are you sure you wish to remove', aFoo
> name,'?'')';
>   callback: [ self confirm: 'Are you sure you wish to remove', aFoo name,'?'
> ];
>   with: each value
>
> The problem with that is, the result of the js confirmation returning true
> is the callback, which is another confirmation.
>
> It seems like I need a separate callback to handle the result of the js
> confim. Is that doable? Any other ideas?
>
> I played around with the WAAsyncComponent onClickCallback: but that didn't
> seem to do what I expected.
>
> Thanks,
> Joel
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Degrading Remove Button

Joel Turnbull-3

This is working great, Lukas, thank you.

One more question. What's the best way to trigger a refresh after the onClick callback?

My best guess is to add a hidden submit button with an empty callback, and activate it via onSuccess: or onComplete:, but I can't figure out how to trigger it because triggerFormElement: ignores submit callbacks. Maybe the hidden submit is not even necessary. Here's where I'm at...

html anchor
    onClick: (html scriptaculous request
       callback: [ self removeItem ];
       confirm: 'Are you sure to remove Foo?';
       onSuccess: ( html scriptaculous request triggerFormElement: 'hiddenSubmit' );
       return: false);
    callback: [ (self confirm: 'Are you sure to remove?') ifTrue: [
self removeItem ] ];
    with: 'remove'




On Fri, Oct 2, 2009 at 12:56 PM, Lukas Renggli <[hidden email]> wrote:
Try something along:

html anchor
    onClick: (html scriptaculous request
       callback: [ self removeItem ];
       confirm: 'Are you sure to remove Foo?';
       return: false);
    callback: [ (self confirm: 'Are you sure to remove?') ifTrue: [
self removeItem ] ];
    with: 'remove'

Lukas

2009/10/2 Joel Turnbull <[hidden email]>:
>
> I have a remove button that I'd like to pop a js confirmation dialog.
>
> I'd like the button to degrade so that if js is disabled, the user will be
> taken to a separate confirmation page, ala the WAComponent confirm:
>
> Here's the closest I've gotten
>
> html submitButton
>   onClick: 'return confirm(''Are you sure you wish to remove', aFoo
> name,'?'')';
>   callback: [ self confirm: 'Are you sure you wish to remove', aFoo name,'?'
> ];
>   with: each value
>
> The problem with that is, the result of the js confirmation returning true
> is the callback, which is another confirmation.
>
> It seems like I need a separate callback to handle the result of the js
> confim. Is that doable? Any other ideas?
>
> I played around with the WAAsyncComponent onClickCallback: but that didn't
> seem to do what I expected.
>
> Thanks,
> Joel
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Degrading Remove Button

Robert Sirois
Try:

...
onSuccess: (html javascript refresh);
...

I've used something similar in the past.

RS


From: [hidden email]
Date: Mon, 5 Oct 2009 10:47:51 -0400
Subject: Re: [Seaside] Degrading Remove Button
To: [hidden email]


This is working great, Lukas, thank you.

One more question. What's the best way to trigger a refresh after the onClick callback?

My best guess is to add a hidden submit button with an empty callback, and activate it via onSuccess: or onComplete:, but I can't figure out how to trigger it because triggerFormElement: ignores submit callbacks. Maybe the hidden submit is not even necessary. Here's where I'm at...

html anchor
    onClick: (html scriptaculous request
       callback: [ self removeItem ];
       confirm: 'Are you sure to remove Foo?';
       onSuccess: ( html scriptaculous request triggerFormElement: 'hiddenSubmit' );
       return: false);
    callback: [ (self confirm: 'Are you sure to remove?') ifTrue: [
self removeItem ] ];
    with: 'remove'




On Fri, Oct 2, 2009 at 12:56 PM, Lukas Renggli <[hidden email]> wrote:
Try something along:

html anchor
    onClick: (html scriptaculous request
       callback: [ self removeItem ];
       confirm: 'Are you sure to remove Foo?';
       return: false);
    callback: [ (self confirm: 'Are you sure to remove?') ifTrue: [
self removeItem ] ];
    with: 'remove'

Lukas

2009/10/2 Joel Turnbull <[hidden email]>:
>
> I have a remove button that I'd like to pop a js confirmation dialog.
>
> I'd like the button to degrade so that if js is disabled, the user will be
> taken to a separate confirmation page, ala the WAComponent confirm:
>
> Here's the closest I've gotten
>
> html submitButton
>   onClick: 'return confirm(''Are you sure you wish to remove', aFoo
> name,'?'')';
>   callback: [ self confirm: 'Are you sure you wish to remove', aFoo name,'?'
> ];
>   with: each value
>
> The problem with that is, the result of the js confirmation returning true
> is the callback, which is another confirmation.
>
> It seems like I need a separate callback to handle the result of the js
> confim. Is that doable? Any other ideas?
>
> I played around with the WAAsyncComponent onClickCallback: but that didn't
> seem to do what I expected.
>
> Thanks,
> Joel
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



Hotmail: Free, trusted and rich email service. Get it now.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Degrading Remove Button

Joel Turnbull-3
That's the ticket, RS. Thanks.

On Mon, Oct 5, 2009 at 11:45 AM, Robert Sirois <[hidden email]> wrote:
Try:

...
onSuccess: (html javascript refresh);
...

I've used something similar in the past.

RS


From: [hidden email]
Date: Mon, 5 Oct 2009 10:47:51 -0400
Subject: Re: [Seaside] Degrading Remove Button
To: [hidden email]



This is working great, Lukas, thank you.

One more question. What's the best way to trigger a refresh after the onClick callback?

My best guess is to add a hidden submit button with an empty callback, and activate it via onSuccess: or onComplete:, but I can't figure out how to trigger it because triggerFormElement: ignores submit callbacks. Maybe the hidden submit is not even necessary. Here's where I'm at...

html anchor
    onClick: (html scriptaculous request
       callback: [ self removeItem ];
       confirm: 'Are you sure to remove Foo?';
       onSuccess: ( html scriptaculous request triggerFormElement: 'hiddenSubmit' );
       return: false);
    callback: [ (self confirm: 'Are you sure to remove?') ifTrue: [
self removeItem ] ];
    with: 'remove'




On Fri, Oct 2, 2009 at 12:56 PM, Lukas Renggli <[hidden email]> wrote:
Try something along:

html anchor
    onClick: (html scriptaculous request
       callback: [ self removeItem ];
       confirm: 'Are you sure to remove Foo?';
       return: false);
    callback: [ (self confirm: 'Are you sure to remove?') ifTrue: [
self removeItem ] ];
    with: 'remove'

Lukas

2009/10/2 Joel Turnbull <[hidden email]>:
>
> I have a remove button that I'd like to pop a js confirmation dialog.
>
> I'd like the button to degrade so that if js is disabled, the user will be
> taken to a separate confirmation page, ala the WAComponent confirm:
>
> Here's the closest I've gotten
>
> html submitButton
>   onClick: 'return confirm(''Are you sure you wish to remove', aFoo
> name,'?'')';
>   callback: [ self confirm: 'Are you sure you wish to remove', aFoo name,'?'
> ];
>   with: each value
>
> The problem with that is, the result of the js confirmation returning true
> is the callback, which is another confirmation.
>
> It seems like I need a separate callback to handle the result of the js
> confim. Is that doable? Any other ideas?
>
> I played around with the WAAsyncComponent onClickCallback: but that didn't
> seem to do what I expected.
>
> Thanks,
> Joel
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



Hotmail: Free, trusted and rich email service. Get it now.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside