Skip to content

pjax.submit doesn't report which button was used #304

@djs52

Description

@djs52

A normal submit will include the name and value of the submit button in the query string. This doesn't happen with the documented approach for using pjax.submit, because the submit event on the form is bound.

I've been inserting an appropriately-configured hidden input to compensate for this:

    $(document).on('click', 'form[data-pjax] input[type=submit]', function() {
        $(this).after('<input type="hidden" name="' + this.name + '" value="' + this.value + '"/>');
    });
    $(document).on('submit', 'form[data-pjax]', function(event) {
        $.pjax.submit(event, '#main')
    })

I don't know if there is a better or more appropriate work-around.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions