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 %>
<%= 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…’)%>
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.
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)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.