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

[FEATURE] Add method parameter to wb-postback to allow all REST methods #9188

Open
at88mph opened this issue Oct 1, 2021 · 4 comments · May be fixed by #9189
Open

[FEATURE] Add method parameter to wb-postback to allow all REST methods #9188

at88mph opened this issue Oct 1, 2021 · 4 comments · May be fixed by #9189

Comments

@at88mph
Copy link
Contributor

at88mph commented Oct 1, 2021

Required information

Is your feature request related to a problem? Please describe.
I have a backend service that accepts PUT requests for new form submissions. The wb-postback API is being used to use AJAX form submission, but it relies on the form.method, which does not allow anything by GET and POST.

I have a PR but it is currently blocked by #9187

Describe the solution you'd like
Given a Form, I would like to add the method parameter to the JSON data-wb-postback:

<form name="meeting-form" action="/meetings/meetings" method="POST" class="form-horizontal wb-postback" data-wb-postback="{&quot;success&quot;:&quot;success-message&quot;,&quot;failure&quot;:&quot;failure-message&quot;,&quot;method&quot;:&quot;PUT&quot;}">

The wb-postback.js already uses the method of the form, so this seems like a trivial change.

Describe alternatives you've considered
Custom javascript

Who shall do the work?
I am seeking guidance because I want to contribute

Additional information (optional)

Timeline

Screenshots

Additional context
Blocked by #9187
Also need guidance on updating documentation

@at88mph at88mph linked a pull request Oct 3, 2021 that will close this issue
3 tasks
@duboisp
Copy link
Member

duboisp commented Oct 6, 2021

@at88mph I would like to understand better your context of use for when the method "PUT" is prefered vs the supported method by the web form. I would like to know if the intend is to support or not the fallback form submission.
For example: Let say the postback plugin are not working and the native HTML form is submitted, is the method "POST" or "GET" set on the HTML form is going to conflict with your use case? Like preventing the transaction.

For a second review reference:

@at88mph
Copy link
Contributor Author

at88mph commented Oct 6, 2021

Hi @duboisp,

In my use case, I'm submitting a form to create a new resource. Our web service API that is receiving the request requires the method to be a PUT. A POST request is considered an Edit function in our web service.

If the wb-postback were to fail to load, then the request would not work, that is correct. The alternative is writing my own JavaScript to load and do the form submission, but much of that would be a duplicate of what the wb-postback would do.

Alternatively, one could also specify a DELETE request to delete a specified resource, for example.

@duboisp
Copy link
Member

duboisp commented Oct 6, 2021

@at88mph thanks for the clarification.

We would need to figure out a way to still provide support when the page is visited in HTML basic mode, like here: https://wet-boew.github.io/wet-boew/demos/wb-postback/wb-postback-en.html?wbdisable=true
We will need to explore how we are going to address this issue. For example providing implementation guidance for author like adding a link to an alternate way to do the same surrounding the web form.

@at88mph
Copy link
Contributor Author

at88mph commented Oct 6, 2021

So the idea would be to support the PUT request even if wb-postback is disabled? I'm not sure that's possible. Even if the method is set to PUT in the HTML <form> the method defaults back to GET. The idea would be that this provides something extra since the only other way to provide a PUT would be to have custom JavaScript.

Thanks for looking into it @duboisp .

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

Successfully merging a pull request may close this issue.

3 participants