jquery-ajax-unobtrusive icon indicating copy to clipboard operation
jquery-ajax-unobtrusive copied to clipboard

Support formaction attribute

Open nprieto95 opened this issue 7 years ago • 28 comments
trafficstars

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.

nprieto95 avatar Jul 26 '18 03:07 nprieto95

Thanks for contacting us, @nprieto95. @kichalla, I was under the impression that even today this is possible, wasn't it?

mkArtakMSFT avatar Jul 27 '18 17:07 mkArtakMSFT

@nprieto95 Could you share a standalone repro project that can represent the issue you are seeing?

kichalla avatar Aug 03 '18 23:08 kichalla

Hi. We're closing this issue as no response or updates have been provided in a timely manner and we have been unable to reproduce it. If you have more details and are encountering this issue please add a new reply and re-open the issue.

mkArtakMSFT avatar Aug 14 '18 16:08 mkArtakMSFT

@nprieto95 You can reopen this issue. The problem is very simple, the formaction attribute on button or input is not taken into account : http://plnkr.co/edit/lc82fluYOGguSHIeKJs2?p=preview When you click on the "Submit to another page" button, the formaction value ("another_action.html") should be called. It's not the case. The PR #36 corrects this.

kakone avatar Sep 05 '18 13:09 kakone

@javiercn. can you please verify this and review the PR? Thanks!

mkArtakMSFT avatar Sep 21 '18 16:09 mkArtakMSFT

Any progress on this? The PR #36 fixing the issue is literally just one line of code, if I understand.

drml avatar Mar 16 '19 11:03 drml

Any progress on this? The PR #36 fixing the issue is literally just one line of code, if I understand.

We will celebrate soon the 1 year of this PR of one line of code. Too bad there was not 5 minutes in 1 year to merge this PR :cry:

kakone avatar Apr 10 '19 08:04 kakone

@mkArtakMSFT, @javiercn, @ryanbrandenburg, ping!

vanillajonathan avatar Aug 26 '19 14:08 vanillajonathan

Just wanted to add that fixing this would be a big help for my team

Stormgail avatar Jan 15 '20 12:01 Stormgail

Just wanted to add that fixing this would be a big help for my team

I think you should update the line of code by yourself and not use the npm package anymore. You must just replace the line url: this.action by url: clickTarget && clickTarget.attr('formaction') || this.action. Don't expect the pull request to be merged, we've been waiting for it a year and a half.

kakone avatar Jan 15 '20 13:01 kakone

Just wanted to add that fixing this would be a big help for my team

I think you should update the line of code by yourself and not use the npm package anymore. You must just replace the line url: this.action by url: clickTarget && clickTarget.attr('formaction') || this.action. Don't expect the pull request to be merged, we've been waiting for it a year and a half.

Thanks, I did exactly that but thought it wouldn't hurt to at least mention it'd be useful

Stormgail avatar Jan 15 '20 15:01 Stormgail

I now also added the support of the formmethod attribute in the PR #36.

kakone avatar Feb 07 '20 09:02 kakone

That's insane, two years for one line of code :)

alden-m avatar May 08 '20 00:05 alden-m

That's insane, two years for one line of code :)

Lol 😂

akifyanbak avatar May 08 '20 01:05 akifyanbak

@mkArtakMSFT, @javiercn, @ryanbrandenburg, @terrajobst ping!

vanillajonathan avatar May 08 '20 13:05 vanillajonathan

Let's celebrate the anniversary this July 26th

nprieto95 avatar May 15 '20 15:05 nprieto95

Let's celebrate the anniversary this July 26th

We are getting closer

kakone avatar Jul 01 '20 13:07 kakone

@mkArtakMSFT, @javiercn, @ryanbrandenburg, @terrajobst ping!

jumpingjackson avatar Jul 09 '20 22:07 jumpingjackson

Let's join, celebrate the anniversary, chit-chat, and get to know each other!

Alden Menz is inviting you to a scheduled Zoom meeting.

Topic: Celebrate ajax unobtrusive feature request anniversary Time: Jul 25, 2020, 02:00 PM Eastern Time (US and Canada)

Join Zoom Meeting https://us04web.zoom.us/j/74857196510?pwd=SmJoSWtJbjYrdlAwck5GamhDR1NFUT09

Meeting ID: 748 5719 6510 Password: 9PWJWg

alden-m avatar Jul 09 '20 23:07 alden-m

@mkArtakMSFT, @javiercn, @ryanbrandenburg, @terrajobst ping! @DamianEdwards, @kichalla, @ajaybhargavb, @Eilon ping!

vanillajonathan avatar Jul 10 '20 09:07 vanillajonathan

After five minutes it is :d let's join and have some fun

alden-m avatar Jul 25 '20 17:07 alden-m

Tagging @Pilchie who is the current owner of this project. Unfortunately I don't work on this project anymore so I don't have much to add to this discussion.

Eilon avatar Jul 27 '20 15:07 Eilon

@Pilchie, after two years of waiting, can you take 2 seconds (no need more) to merge the pull request #36. Thanks in advance.

kakone avatar Sep 28 '20 15:09 kakone

Okay, Houston, we have a problem here !

kakone avatar Nov 04 '20 23:11 kakone

Just wanted to add that fixing this would be a big help for my team

I think you should update the line of code by yourself and not use the npm package anymore. You must just replace the line url: this.action by url: clickTarget && clickTarget.attr('formaction') || this.action. Don't expect the pull request to be merged, we've been waiting for it a year and a half.

Thanks for the hint, I was heavily looking for it :D

mkalinski93 avatar Dec 09 '20 17:12 mkalinski93

@mkArtakMSFT, @javiercn, @ryanbrandenburg, @terrajobst ping!

I think its ridiculous that this simple 1 line of code fix cannot be be merged and published after 2+ years. Bueller?? Bueller?? Do we need to send some angry tweets?

jumpingjackson avatar Dec 09 '20 17:12 jumpingjackson

IMPORTANT: This repository is in maintenance mode. We do not work, nor plan to work on any new features. Only security and critical bug fixes will be worked on.

I think it's a stupid thing. This little library is essential when you develop in ASP.Net Core, and it doesn't cost much to include one PR per year. I will have to offer another NPM package to support the formaction attribute :worried:

kakone avatar Jan 28 '21 10:01 kakone

IMPORTANT: This repository is in maintenance mode. We do not work, nor plan to work on any new features. Only security and critical bug fixes will be worked on.

I think it's a stupid thing. This little library is essential when you develop in ASP.Net Core, and it doesn't cost much to include one PR per year. I will have to offer another NPM package to support the formaction attribute 😟

Yeah @mkArtakMSFT! 😡

vanillajonathan avatar Jan 28 '21 10:01 vanillajonathan