Hi everyone! A few days I can't resolve a task. I want to build a single
page app without any page refresh. So I have a button 'Add', onclick it
inserts in a DOM a simple remote:true form and when I try to submit this
form - nothing happens BUT if i refresh the page - it works. Guess some
handler is absent but not sure. Advise please. Here's my form
  <%= form_tag(:add_task, method: 'post', remote: true) do %>
             <td>
               <span class="glyphicon glyphicon-plus"></span>
             </td>
             <td>
               <%= text_field(:task,:project_id,type: 'hidden',value:
@project.id)%>
               <%= text_field(:task,:name,class: 'form-control
task_field', placeholder: 'Start typing here to create a task...')%>
             </td>
             <td>
               <%= button_tag('Add task',class:'btn btn-add_task') %>
             </td>
         <% end %>

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@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/3793fb55424bbc0e768e149163902699%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Colin Law at Feb 25, 2016 at 8:05 pm

    On 25 February 2016 at 18:59, Andrew Dig wrote:
    Hi everyone! A few days I can't resolve a task. I want to build a single
    page app without any page refresh. So I have a button 'Add', onclick it
    inserts in a DOM a simple remote:true form and when I try to submit this
    form - nothing happens BUT if i refresh the page - it works. Guess some
    handler is absent but not sure. Advise please. Here's my form
    <%= form_tag(:add_task, method: 'post', remote: true) do %>
    <td>
    <span class="glyphicon glyphicon-plus"></span>
    </td>
    <td>
    <%= text_field(:task,:project_id,type: 'hidden',value:
    @project.id)%>
    <%= text_field(:task,:name,class: 'form-control
    task_field', placeholder: 'Start typing here to create a task...')%>
    </td>
    <td>
    <%= button_tag('Add task',class:'btn btn-add_task') %>
    </td>
    <% end %>
    The first thing to do is to look in development.log and see if it
    submitting correctly.

    Colin

    --
    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+unsubscribe@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/CAL%3D0gLuTGdTP9tsma-xp-H7bgVi7-v-Zi5NN-LJo1PVXJ0-o5g%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Andrew Dig at Feb 25, 2016 at 9:04 pm
    already checked. nothing written in the log

    --
    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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@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/d2665e247f77e6261a58d13c1d3f974c%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Colin Law at Feb 25, 2016 at 9:28 pm

    On 25 February 2016 at 21:03, Andrew Dig wrote:
    already checked. nothing written in the log
    When replying please quote the previous message, this is is a mailing
    list not a forum (though you may be using it via a forum like
    interface). If you don't we have to look back through previous
    messages to find what you are replying to.

    I presume that you mean that when you press the button absolutely
    nothing happens at the server. In that case your submit button is not
    working.

    I notice that you seem to have a form that is a single row in a table,
    that is not valid html. A form can wrap a complete table or exist
    within a cell, but not wrap part of a table. That may or may not be
    the problem you are seeing, but you must fix that first. Even if it
    appeared to work it may not work in a different browser or a different
    version of the same browser.

    Colin

    --
    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+unsubscribe@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/CAL%3D0gLuiHvZ5seQdSb3n421zwT27FzeVii5piFjZvSaDTR-nsw%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Andrew Dig at Feb 26, 2016 at 7:44 am

    Colin Law wrote in post #1181667:
    On 25 February 2016 at 21:03, Andrew Dig wrote:
    already checked. nothing written in the log
    When replying please quote the previous message, this is is a mailing
    list not a forum (though you may be using it via a forum like
    interface). If you don't we have to look back through previous
    messages to find what you are replying to.

    I presume that you mean that when you press the button absolutely
    nothing happens at the server. In that case your submit button is not
    working.

    I notice that you seem to have a form that is a single row in a table,
    that is not valid html. A form can wrap a complete table or exist
    within a cell, but not wrap part of a table. That may or may not be
    the problem you are seeing, but you must fix that first. Even if it
    appeared to work it may not work in a different browser or a different
    version of the same browser.

    Colin
    Yes, you're right.I also noticed that but I guess if it was a main
    reason that shouldn't work after page refresh but it worked....Whatever
    I resolved a task via inline on-click handler(maybe a hack but works
    properly)

    --
    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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@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/316d165c00b4486a5159d6e8e56e3d88%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 25, '16 at 6:59p
activeFeb 26, '16 at 7:44a
posts5
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Andrew Dig: 3 posts Colin Law: 2 posts

People

Translate

site design / logo © 2021 Grokbase