Problems with ajax form

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…’)%>


<%= button_tag(‘Add task’,class:‘btn btn-add_task’) %>

<% end %>

On 25 February 2016 at 18:59, Andrew D. [email protected] wrote:

          <%= 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…’)%>


<%= button_tag(‘Add task’,class:‘btn btn-add_task’) %>

<% end %>

The first thing to do is to look in development.log and see if it
submitting correctly.

Colin

already checked. nothing written in the log

On 25 February 2016 at 21:03, Andrew D. [email protected] 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

Colin L. wrote in post #1181667:

On 25 February 2016 at 21:03, Andrew D. [email protected] 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)