jquery-pjax icon indicating copy to clipboard operation
jquery-pjax copied to clipboard

Support HTML5 `formaction` attribute

Open alpha1 opened this issue 11 years ago • 2 comments

Pjax does not use formation on a input type="submit".

Steps to duplicate:

  1. Create Form with pjax submission with action being a different page or query.
  2. Test Form. It will work and use the form's action attribute to change the url.
  3. Now add a submit button with a formaction different than that of the form itself.
  4. Submit via Pjax. The URL from the form's action's attribute will be used rather than the formaction on the submit.

alpha1 avatar Jun 20 '14 17:06 alpha1

This library doesn't yet support emerging HTML5 standards like formaction. It might in the future.

mislav avatar Sep 15 '14 20:09 mislav

I solved the problem like this:

$(document).on("submit", "form[data-pjax]", function (event) { var config = {}; var url = $(":input[type=submit][formaction]:focus", $(this)).attr("formaction"); if (url) { config.url = url; } $.pjax.submit(event, "#Container", config); });

raphaelm22 avatar Mar 15 '16 13:03 raphaelm22