form_tag wih two Button

i have a form_tag with two button:
<% form_tag "/controller/action" %>
<% submit_tag 'send' %>
<% submit_tag 'check', :onclick => "javascript:... %>
<% end %>
I would if I click on check-button, javascript is ONLY called and not
the Action. And when i click the send-button the action is called.

Can someone helps me.

Thanks im Advance.

Hi
U can try this

Controller:

def new
if params[:save]
@val = Product.new(params[:product])
@val.save
@flash[:notice]=“Supplier successfully created.”
end
if params[:check]
@users = Product.find(params[:id])
@users.update_attributes(params[:product])
@flash[:notice]=“Supplier has been updated successfully.”
end
end

Rhtml
<% form_tag :action=>new %>
<% submit_tag ‘send’ ,:name=>save%>
<% submit_tag ‘check’, :name=>check,:onclick => "javascript:… %>
<% end %>

Thanks
Seenu

hi Seenu, thanks for replay.
I think I have not correctly formulated my problem.
I want, if I click the check button only the javascript function
(check()) called
.
.
<script type="text/javascript">
function scheck(){
alert("test");
}
</script>
<% form_tag :action=>new %>
<% submit_tag 'send' ,:name=>save%>
<% submit_tag 'check', :name=>check,:onclick => "check()" %>
<% end %>
when I click on ckeck-button: check() and action are called. But I want,
if I click the check button ONLY the javascript function (check())
called.
Sorry, I know my English is not good. but I hope you understand me..:slight_smile:

Tnaks im Advance

In order to create a JavaScript-only button, you have to use
"button_to_function" helper instead of "submit_tag". See the
following documentation.

http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#M001757

Glen