Onsubmit: return false; ignored if remote: true in Rails 4

In Rails 4, I have the following:

<%= form_tag("editor/work", remote: true, method: "post", name: "myform", onsubmit: "validateForm()", target:"_blank", id: "editor_form") do %>


My validateForm function looks like this:

function validateForm() {
  return false;


Even though it gets called, the AJAX feed is done. How can I avoid this? So if the validateForm function returns false am I avoiding the AJAX feed?


source to share

1 answer

try typing instead:

onsubmit: "validateForm()"


:onclick => "return validateForm();"




All Articles