vitmalina / w2ui

UI widgets for modern apps. Data table, forms, toolbars, sidebar, tabs, tooltips, popups. All under 120kb (gzipped).
http://w2ui.com
MIT License
2.67k stars 727 forks source link

Form - Record Update Sent As POST #2333

Closed harrisdev closed 2 years ago

harrisdev commented 2 years ago

Short description I'm submitting this as a bug because I've read the documentation and comments and I'm unable to submit a form without getting a 405 error from my api server.

I've got a typical form that I load a record into and I set form.method to 'PUT', the form.url to 'my api url' and the form.recid to the record primary key, but the request is always sent as a POST request. The dataType is set to 'RESTFULL'.

I've added the following code to line #19572 of w2ui.js and it seems to resolve the issue. if(self.method){ fetchOptions.method = self.method; }

Sorry for the bug submission if this is not a bug and I'm not using the form component correctly, but I've been unable to get a form to submit a record update request as 'PUT'.

What is current behavior See description above.

What is desired behavior Request be sent as PUT.

Link to jsfidle/codepan with sample code ...

Steps to reproduce or sample ...

vitmalina commented 2 years ago

Fixed.

Alternatively, you can add onSubmit event and in the event it would have httpMethod that you can modifdy

onSubmit(event) { 
    event.httpMethod = 'PUT' 
}
harrisdev commented 2 years ago

I'll remember that bit of info. W2ui is a great work! Just want to say thank you. It's very much appreciated.