Forum: Ruby on Rails form_for with :onsubmit

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Maite .. (Guest)
on 2009-01-30 14:19
hello list

I have a problem with form_for and :onsubmit

this is may code

<div id="note">
<% javascript_tag do %>
function valor(){
alert('aqui');
}
<% end %>

<% form_for :accion, :url=>{:controller=> "accions", :action=>
"anadir"}, :html=>{:onsubmit=>"valor();"} do |f| %>

.....
<%= f.submit "Go" %>
<%end %>

</div>

when I click in buttom nothing happen with javascript function valor(),
I don´t see the alert

this is my html code
<div id="note">
<form onsubmit="valor();" method="post" action="/accions/anadir">
<div style="margin: 0pt; padding: 0pt;">
</div>
<table width="700" border="1">
</table>
</form>
</div>

but i don´t find the javascript code of javascript_tag

any idea???

thanks for all
This topic is locked and can not be replied to.