Form with two buttons

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

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” [email protected]

Thanks for responding.

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

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

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” [email protected]

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

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” [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs