On Aug 8, 2013, at 11:54 AM, Thomas Dragsbæk <tdragsb...@gmail.com> wrote:
> Im trying to submit a rails remote form in a bootstrap popover, but it keeps > processing as html. There are no js errors, controller responds to js and i > have a create.js.erb. Can someone please point me to the problem? > > Below is the content of my popover. Users have to options when submitting a > form - in order to make it faster for the user, i made two forms so the user > can choose an option and submit by clicking only one button. > > POPOVER CONTENT: > <div id="booking_dialog"> > <div id="calendar_form" class="booking_dialog_content"> > > <%= form_for @event || Event.new(:owner_id => current_block.actor_id, > :interval => 1, :title => 'option1', :room_id => > current_block.loundry.room_id), :remote => true do |f| %> I'm going out on a limb here, but I think it's doing something with the precedence of || in your first bit. Try wrapping the @event || Event.new in parens and see what happens? <%= form_for (@event || Event.new(:owner_id => current_block.actor_id, :interval => 1, :title => 'option1', :room_id => current_block.loundry.room_id)), :remote => true do |f| %> > <% if f.object.errors.any? %> > <div id="error_explanation"> > <h2><%= pluralize(f.object.errors.count, "error") %> evitaron que > se guardara esta actividad:</h2> > <ul> > <% f.object.errors.full_messages.each do |msg| %> > <li><%= msg %></li> > <% end %> > </ul> > </div> > <% end %> > > <%= f.hidden_field :owner_id %> > <%= f.hidden_field :start_at %> > <%= f.hidden_field :end_at %> > <%= f.hidden_field :all_day %> > <%= f.hidden_field :room_id %> > <%= f.hidden_field :title %> > <%= f.hidden_field :description %> > <%= f.hidden_field :frequency %> > <%= f.submit 'Option1', id: option1_icon_link'%> > <% end %> > > <%= form_for @event || Event.new(:owner_id => current_block.actor_id, > :interval => 1, :title => 'option2', :room_id => > current_block.loundry.room_id), :remote => true do |f| %> > > <% if f.object.errors.any? %> > <div id="error_explanation"> > <h2><%= pluralize(f.object.errors.count, "error") %> evitaron que > se guardara esta actividad:</h2> > <ul> > <% f.object.errors.full_messages.each do |msg| %> > <li><%= msg %></li> > <% end %> > </ul> > </div> > <% end %> > > <%= f.hidden_field :owner_id %> > <%= f.hidden_field :start_at %> > <%= f.hidden_field :end_at %> > <%= f.hidden_field :all_day %> > <%= f.hidden_field :room_id %> > <%= f.hidden_field :title %> > <%= f.hidden_field :description %> > <%= f.hidden_field :frequency %> > <%= f.submit 'Option2', id: 'option2_icon_link'%> > <% end %> > > </div> > > </div> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/1ad9196a-92bf-471b-8e16-3c524f8d4509%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0C6F33D2-F3C7-4D1B-B630-56C2DEFDB190%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.