This form can be used to create a new resource or to update an existing one. To update an existing resource, we need to send a PATCH request to the server. This commit adds ability to send PATCH requests to the backend. HTML forms unfortunately do not support PATCH requests. There are 2 common ways to work around this limitation: 1. Send regular `POST` request with special hidden input and backend can handle the request as if it is `PATCH` based on the hidden input field. 2. Use JavaScript to change the request method before submitting the form I opted for the second approach because it fits to RESTful semantics better. Also the proposal for extending HTML form methods lists additional drawbacks regarding use of hidden input fields [1]. [1] https://alexanderpetros.com/triptych/form-http-methods#hidden-input-hack
25 KiB
25 KiB