Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HTML5 formaction attribute #404

Open
alpha1 opened this issue Jun 20, 2014 · 2 comments
Open

Support HTML5 formaction attribute #404

alpha1 opened this issue Jun 20, 2014 · 2 comments
Labels

Comments

@alpha1
Copy link

alpha1 commented Jun 20, 2014

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.
@mislav
Copy link
Collaborator

mislav commented Sep 15, 2014

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

@mislav mislav changed the title Pjax Form submission Does Not Use Formaction Support HTML5 formaction attribute Sep 15, 2014
@mislav mislav added the feature label Oct 14, 2014
@raphaelm22
Copy link

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);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants