# Non-functioning submit button

**URL:** <https://www.ruby-forum.com/t/non-functioning-submit-button/105058>\
**Category:** Rails\
**Created:** [May 25, 2007, 11:36am UTC](https://www.ruby-forum.com/t/non-functioning-submit-button/105058 "2007-05-25T11:36:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![milo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://www.ruby-forum.com/u/milo)\
**Post date:** [May 25, 2007, 11:36am UTC](https://www.ruby-forum.com/t/non-functioning-submit-button/105058/1 "2007-05-25T11:36:17Z")

</div>

I have a form for users to select from a set of files they’d like to  
download (all, by default), set up something like this:

\<%= start\_form\_tag(:action =\> “download”) %\>

| \<% @file\_types.each do |ft| %\> **\<%= ft %\> files**.  
 \<% end %\> |

\<%= end\_form\_tag %\>  
\<%= submit\_tag("Download") %\>

Unfortunately, clicking on the “Download” button does nothing. Changing  
the action doesn’t make any difference.I’ve used similar code with other  
forms on the site and they work, so the fault must be in the code above.  
Can anyone suggest what the problem could be with it?  
Thanks.

---

<div class="post-metadata">

**Author:** ![milo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://www.ruby-forum.com/u/milo)\
**Post date:** [May 25, 2007, 1:20pm UTC](https://www.ruby-forum.com/t/non-functioning-submit-button/105058/2 "2007-05-25T13:20:28Z")

</div>

can you try to switch those two lines ?

\<%= end\_form\_tag %\>  
  
\<%= submit\_tag(“Download”) %\>

to

\<%= submit\_tag(“Download”) %\>  
\<%= end\_form\_tag %\>

your submit butto has something like a context, the form.

Marcel

On 25 Mai, 11:36, Milo T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![milo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://www.ruby-forum.com/u/milo)\
**Post date:** [April 24, 2009, 2:21pm UTC](https://www.ruby-forum.com/t/non-functioning-submit-button/105058/3 "2009-04-24T14:21:59Z")

</div>

Hi Thurston.  
Same functionality i want to implement in my application i.e i want  
to download the files seelcted by checkbox.

Can you provide the download method implemented in your code.

actually i have written my own method in controller it is not  
working.But if use this method as a download link it is working.  
What i understand is here the download method is not able to get the  
id with check boxes.And i have checked in log file i am able collect  
all the ids which are selected by checkbox.Now the problem here is the  
download method i have written could not able to get the id from  
group of ids.

can you suggest me how to implement this.

## my code details: in views;

\<% for containerformat in @containerformats %\>  
\<% if i==0 %\>

Streamname

|
| |
|
| |

| \<%= check\_box\_tag "containerformat\_ids[]",containerformat.id%\> | \<%=h containerformat.streamName %\> | | | | | | | | | \<%= link\_to 'Show', containerformat %\> | | \<%= link\_to 'Edit', edit\_containerformat\_path (containerformat) %\> | | | \<%= link\_to "download", {:controller=\> "containerformats", :action =\> "selected", :id =\> containerformat.id} %\> |

\<% end %\> \<% end %\> \<%= submit\_tag "Mark as Complete" %\> \<% end %\>  
---- in controller: -------------------- def selected

@containerformat = Containerformat.find(containerformat\_ids[])  
if (FileTest.exist?(@containerformat.location))  
fileptr = File.open(@containerformat.location,“rb”){ |f|  
@data = f.read(fileptr)}  
ext = File.extname(@containerformat.streamName)

```
        if ext == ''
           extension = File.extname(@containerformat.location)
           send_data(@data,:filename => @containerformat.name

```

+extension,  
:disposition =\> ‘attachment’)  
else  
send\_data(@data,:filename =\>  
@containerformat.streamName,  
:disposition =\> ‘attachment’)  
end  
end

end

* * *

can you suggest me where i am doing the mistake.  
Thanks  
Srikanth

On May 25 2007, 4:24 pm, Milo T. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![milo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://www.ruby-forum.com/u/milo)\
**Post date:** [May 25, 2007, 1:24pm UTC](https://www.ruby-forum.com/t/non-functioning-submit-button/105058/4 "2007-05-25T13:24:59Z")

</div>

lanzm wrote:

> \<%= end\_form\_tag %\>  
>   
> \<%= submit\_tag(“Download”) %\>
> 
> to
> 
> \<%= submit\_tag(“Download”) %\>  
> \<%= end\_form\_tag %\>

That works, thanks.  
Strange, as I didn’t encounter the problem elsewhere.
