zaid
October 15, 2007, 7:05pm
1
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
zaid
October 15, 2007, 7:51pm
2
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]
zaid
October 15, 2007, 8:00pm
3
Thanks for responding.
But what I want is calling the method llamada in the controller.
No llamada.rhtml.
zaid
October 15, 2007, 8:56pm
4
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
zaid
October 15, 2007, 8:16pm
5
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]
zaid
October 15, 2007, 9:08pm
6
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
zaid
October 17, 2007, 9:31am
7
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]