Ruby Forum Ruby on Rails > cancel upload button

Posted by Joan Gu (joan2kus)
on 19.08.2008 17:11
How can I add a cancel button next to the upload button which will stop
the uploading of multiple files, and how would it be done?

Your reply is appreciated.
Posted by Bill Walton (Guest)
on 19.08.2008 21:13
(Received via mailing list)
Hi Joan,

Joan Gu wrote:

There are two components to your question, so I'll break it up.

> How can I add a cancel button next to the upload button

According to the W3C spec, a form can only have one button within the
<form></form> tags that submits the form params.  As long as you don't 
need
to carry along the form params on your cancel, the easiest way to do 
what
you're wanting is to use a button_to outside your form tags and then use 
CSS
to position it, from a visual perspective, along-side the submit button 
and
make it _appear_ to the user that side the form has two buttons.

> which will stop the uploading of multiple files, and how would it be done?

If you mean 'stop the uploading after its been started', this is a tough 
one
and I'm not aware of any built-in support in either Ruby or Rails for 
doing
it.  It's a good question though.  I know the capability is built into 
other
tools, so there must be a way to do it.  Maybe someone else will be able 
to
help with this.  It's definitely interesting.  I'll cipher on it and see 
if
I can come up with something.

Best regards,
Bill
Posted by Joan Gu (joan2kus)
on 20.08.2008 16:42
Hey Bill,

Thanks for reply. Yes, I meant to be stop the uploading after it's been 
started. I did some search, but comes with no rails solution. Flash is 
an alternative way to do it. Well, last time I use Flash was 7 years 
ago...

Best,
Joan
Posted by Hassan Schroeder (Guest)
on 20.08.2008 17:28
(Received via mailing list)
On Tue, Aug 19, 2008 at 12:13 PM, Bill Walton <bill.walton@charter.net> 
wrote:

> According to the W3C spec, a form can only have one button within the
> <form></form> tags that submits the form params.

Uh, sorry, that's simply not true; multiple SUBMIT buttons are fine.

<http://www.w3.org/TR/html401/interact/forms.html#submit-button>

17.2.1 Control types

HTML defines the following control types:

buttons
  Authors may create three types of buttons:
    submit buttons: When activated, a submit button submits a form. A
form may contain
        more than one submit button.

FWIW,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
Posted by Bill Walton (Guest)
on 20.08.2008 17:42
(Received via mailing list)
Hi Hassan,

Hassan Schroeder wrote:

> Uh, sorry, that's simply not true; multiple SUBMIT buttons are fine.
>
> <http://www.w3.org/TR/html401/interact/forms.html#submit-button>

Thanks for the correction.  I was thinking forms within forms, which is 
how
this typically comes up.  You are correct of course.

Best regards,
Bill
Posted by Peter De Berdt (Guest)
on 20.08.2008 20:01
(Received via mailing list)
On 20 Aug 2008, at 16:42, Joan Gu wrote:

> Thanks for reply. Yes, I meant to be stop the uploading after it's  
> been
> started. I did some search, but comes with no rails solution. Flash is
> an alternative way to do it. Well, last time I use Flash was 7 years
> ago...

There is no solution with normal form submits, and you don't need to
know anything about Flash to use a Flash uploader. Go check on
swfupload.org and search the list archives for a post i made about
SWFUpload and Rails.


Best regards

Peter De Berdt
Posted by Bill Walton (Guest)
on 20.08.2008 20:18
(Received via mailing list)
Hi Peter,

Peter De Berdt wrote:

> There is no solution with normal form submits, and you
> don't need to know anything about Flash to use a Flash
> uploader. Go check on swfupload.org and search the list
> archives for a post i made about SWFUpload and Rails.

That's cool.  Looks like something I'll want to add to my toolkit.  I
_would_ like to understand how it's done though.  I haven't been able to
come up with the right search string for Google.  Nothing gets me to the
protocol definition type stuff I'm expecting looking for.  Can you point 
me?

Thanks,
Bill