Parameter in a image_submit_tag?

You can send a parameter in a image_submit_tag?

I have two buttons on a form and I do not know how to differentiate
which has been pressed.

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

Thank you

Thank you

On Oct 15, 3:17 pm, “Ramón Castro” [email protected]
wrote:

You can send a parameter in a image_submit_tag?

I have two buttons on a form and I do not know how to differentiate
which has been pressed.

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

Ramon – I just had a similar case with submit_tag (which creates a
submit button and calls the action associated with the form). I
solved the problem by adding a :name parameter as one of the optional
parameters, then testing for in in the submit action associated with
the form. (I am not sure if :name is special, I was just copying an
example I found :-). , for example

<=% Image_submit_tag ("…/ images / eliminar.gif ", :name =>
“del_image”) %>

then in the controller, if your form action was called “manage_image”,
you can test for the presence of the specific name value in the params
hash, like so:

def manage_image
if params[‘del_image’] ##
… code to delete the image …
else
… code to add the image …
end
end

Here’s the link I found with a more complete description of the
solution:
http://www.railsdiary.com/diary/two_submit_buttons

Tom

I wish I had the

Davicín … wrote:

Thank you
You have to check
if params[‘del_image.x’] ##
… code to delete the image …
else
… code to add the image …
end