# Multiple images\_submit\_tag \*all\* "names" are given as parameters

**URL:** <https://www.ruby-forum.com/t/multiple-images-submit-tag-all-names-are-given-as-parameters/137564>\
**Category:** Rails\
**Created:** [May 14, 2008, 7:23am UTC](https://www.ruby-forum.com/t/multiple-images-submit-tag-all-names-are-given-as-parameters/137564 "2008-05-14T07:23:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkahn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jkahn](https://www.ruby-forum.com/u/jkahn)\
**Post date:** [May 14, 2008, 7:23am UTC](https://www.ruby-forum.com/t/multiple-images-submit-tag-all-names-are-given-as-parameters/137564/1 "2008-05-14T07:23:45Z")

</div>

I have a form like so:

\<% form\_remote\_tag(:url =\> { :action =\> :foo}, :complete =\>  
“do\_some\_cool\_ajax(request);”) do %\>  
\<%= text\_field\_tag :myInput, params[:myInput], :size =\> 80 %\>

  

\<%= submit\_tag "do function 1", :name =\> "f1"%\>

\<%= submit\_tag "do funciton 2", :name =\> "f2"%\>

 \<%= image\_submit\_tag("function3.png", :name =\> "f3")%\> \<%= image\_submit\_tag("function4.png", :name =\> "f4")%\> \<%= image\_submit\_tag("function5.png", :name =\> "f5")%\> \<%= image\_submit\_tag("function6.png", :name =\> "f6")%\> 
\<% end %\>

I would hope to get parameters that have only one of the names so that  
I can test like so

if params[“f1”]

# do some f1 stuff

else if params[“f2”]

# do some f2 stuff

else…

For this to work I need something like this in params:

Example 1: Parameters: {“f1”=\>"", “action”=\>“foo”,  
“controller”=\>“bar”, “myInput”=\>“foobar”}

However I’m getting

Example 2: Parameters: {“f1”=\>"", “f2”=\>"", “f3”=\>"", “f4”=\>"",  
“f5”=\>"", “f6”=\>"", “action”=\>“foo”, “controller”=\>“bar”,  
“myInput”=\>“foobar”}

Any ideas on how to isolate each of these actions so that I know which  
submit was actually sent? Google searching lists a buch of sites that  
say Example 1 should work.

I’ve tested on osx both firefox and safari and I get the same results.

---

<div class="post-metadata">

**Author:** ![jkahn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jkahn](https://www.ruby-forum.com/u/jkahn)\
**Post date:** [May 17, 2008, 8:19pm UTC](https://www.ruby-forum.com/t/multiple-images-submit-tag-all-names-are-given-as-parameters/137564/2 "2008-05-17T20:19:24Z")

</div>

For reference. It turns out that the Prototype library is not  
designed to handle multiple submits of this type in an Ajax form. It  
is a limitation that may be addressed in the future. In the meantime  
it appears that the best answer is to create a hidden field, and fill  
it with a value when a image is clicked.

j
