# Form with two buttons

**URL:** <https://www.ruby-forum.com/t/form-with-two-buttons/117294>\
**Category:** Rails\
**Created:** [October 15, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294 "2007-10-15T19:05:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e95f7d/32.png) [@zaid](https://www.ruby-forum.com/u/zaid)\
**Post date:** [October 15, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294/1 "2007-10-15T19:05:35Z")

</div>

Hi,

I need to make a form with two buttons. But I do wrong. And why not can  
be.

## form:

\<%= form\_tag :controller =\> ‘establishment\_contents’, :action =\>  
‘llamada’, :opMenu =\> opcionMenu %\>  
[…]  
\<%= image\_submit\_tag ("…/images/incluir.gif", :op=\>“addImage”) %\>  
[…]  
\<%= image\_submit\_tag ("…/images/eliminar.gif", :op=\>“delImage”) %\>  
\<%= end\_form\_tag %\>

## establishment\_contents\_controller.rb:

def llamada  
if (params[:op].nil?) then  
if (params[:op] == “delImage”) then  
destroy #Borra imagen  
elsif (params[:op] == “addImage”) then  
addImagenContenido #AÃ±ade imagen  
end  
end  
end

## The error:

Template is missing  
Missing template  
./script/…/config/…/app/views/establishment\_contents/llamada.rhtml

Thank you

---

<div class="post-metadata">

**Author:** ![zaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e95f7d/32.png) [@zaid](https://www.ruby-forum.com/u/zaid)\
**Post date:** [October 15, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294/2 "2007-10-15T19:51:41Z")

</div>

Look in your Views directory.

Do you see a Llamada folder with llamada.rhtml inside it?

You shouldn’t because that is the file your app is looking for.

You need to create a View template named llamada.rhtml for the  
information to appear in.

On Oct 15, 12:05 pm, “Ramón Castro” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![zaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e95f7d/32.png) [@zaid](https://www.ruby-forum.com/u/zaid)\
**Post date:** [October 15, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294/3 "2007-10-15T20:00:29Z")

</div>

Thanks for responding.

But what I want is calling the method llamada in the controller.  
No llamada.rhtml.

---

<div class="post-metadata">

**Author:** ![zaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e95f7d/32.png) [@zaid](https://www.ruby-forum.com/u/zaid)\
**Post date:** [October 15, 2007, 8:56pm UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294/4 "2007-10-15T20:56:08Z")

</div>

the output needs a place to go. if you have a different view to  
display the results… user the render command

render :action =\> “other\_action\_name”

or

render :partial =\> "other\_action\_partial

---

<div class="post-metadata">

**Author:** ![zaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e95f7d/32.png) [@zaid](https://www.ruby-forum.com/u/zaid)\
**Post date:** [October 15, 2007, 8:16pm UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294/5 "2007-10-15T20:16:52Z")

</div>

You’re welcome.

Just try putting a file named llamada.rhtml in the  
establishment\_contents folder and see what happens.

Every time I get a “TEMPLATE MISSING” error, it has meant I have  
failed to create a file to contain the output of the method.

On Oct 15, 1:00 pm, “Ramón Castro” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![zaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e95f7d/32.png) [@zaid](https://www.ruby-forum.com/u/zaid)\
**Post date:** [October 15, 2007, 9:08pm UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294/6 "2007-10-15T21:08:58Z")

</div>

I got that I execute the method call. The problem was that  
The parameter op was not looking for and that there was no render …

Now my problem is to know how to send a parameter in a  
Image\_submit\_tag. It is possible?

I command in each of the buttons a parameter op to know if  
A high or low.

\<=% Image\_submit\_tag ("…/ images / incluir.gif “: op =\>” addImage “)%\>  
\<=% Image\_submit\_tag (”…/ images / eliminar.gif “: op =\>” delImage ")%\>

How could we do?

Thank you

---

<div class="post-metadata">

**Author:** ![zaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e95f7d/32.png) [@zaid](https://www.ruby-forum.com/u/zaid)\
**Post date:** [October 17, 2007, 9:31am UTC](https://www.ruby-forum.com/t/form-with-two-buttons/117294/7 "2007-10-17T09:31:44Z")

</div>

here:

> def llamada  
> if (params[:op].nil?) then  
> if (params[:op] == “delImage”) then  
> destroy #Borra imagen  
> elsif (params[:op] == “addImage”) then  
> addImagenContenido #Añade imagen  
> end  
> end  
> end

maybe you wanted to use unless(params[:op].nil?)

On Oct 16, 12:05 am, “Ramón Castro” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
