Hello, Hello,
I am would like use button type="submit". I realised 2 tests :
- one with standard form and an other with ajax form
<% form_for :name , @name , names_url, :html => { :method => :post } do
|f| %>
<button type="submit" id="name_titre"
name="name[titre]"
value="bolo">Bolo No Ajax</button>
<button type="submit" id="name_titre"
name="name[titre]"
value="tom">Tom No Ajax</button>
<% end %>
This form workes. A new name was creates with no empty attributes.
<% form_remote_for :name ,:url => names_url, :html => { :method =>
:post
} do |f| %>
<button type="submit" id="name_titre"
name="name[titre]"
value="bolo">Bolo With Ajax</button>
<button type="submit" id="name_titre"
name="name[titre]"
value="tom">Tom With Ajax</button>
<% end %>
In this form, the new name was created and save in dbb but his
attribute titre is empty.
my method create
def create
@name = Name.new params[:name]
@name.save!
respond_to do |type|
type.html { redirect_to names_path }
type.js {render}
end
end
Thanks for help
Dans la version ajex l''instance est bien créé et sauvegardé dans la bdd
mais je un valeur vide pour le tire
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---