Skip to content

Support formaction attribute #40

Open
@nprieto95

Description

@nprieto95

This is an issue in support of the PR #36 . I hereby present a concrete case in which my personal experience with the product would improve if the functionality shown in that PR was merged.

Currently, when having a form like this one:

<form action="/Management/Products/Edit/A001"
    data-ajax="true"
    data-ajax-method="Post"
    data-ajax-mode="replace"
    data-ajax-update="#preview-container"
    id="form0" method="post">
    <div class="row">
        <section class="col-md-9">
            <h2>Edit</h2>
            <div class="form-row">
                <div class="form-group col-md-12">
                    <label for="Name">Name</label>
                    <input class="text-box single-line" id="Name" name="Name" type="text" value="Test" />
                </div>
            </div>
        </section>
        <section class="col-md-3">
            <h2>Preview</h2>
            <div id="preview-container">
                <product-card code="A001" name="Test"></product-card>
            </div>
        </section>
    </div>
    <a class="btn btn-dark" href="/Management/Products">Cancel</a>
    <button type="submit" class="btn btn-secondary" formaction="/Management/Products/Preview">
        Preview
    </button>
    <button type="submit" class="btn btn-success">
        Save
    </button>
</form>

clicking on the "Preview" button causes a request to be isssued to /Management/Products/Edit/A001 instead of /Management/Products/Preview . The second case would be desired as that is the destination that would be hit if we were using synchronous, old-style forms without unobtrusive jquery-ajax support.

Supporting formaction natively would eliminate the need to sometimes come up with workarounds to use a library that is really good in every other aspect I had the chance to encounter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions