Problem to solve
There is no way to do a native post request to the server using the Form component. It would be cool to have all the state management and validation that comes with the Form with a native post at the end of it.
Proposal
Allow the onSubmit prop to take a string of 'post' | 'put' | 'patch' along with the callback function that you can pass in now. If a string is passed in, then the method attribute on the form will be populated.
Then when the form is submitted it will be validated and then only when valid the form will be submitted.
We should probably also add a new prop for the action that allows us to submit the form to a different URL
Links / References
Problem to solve
There is no way to do a native post request to the server using the
Formcomponent. It would be cool to have all the state management and validation that comes with theFormwith a native post at the end of it.Proposal
Allow the
onSubmitprop to take a string of'post' | 'put' | 'patch'along with the callback function that you can pass in now. If a string is passed in, then themethodattribute on the form will be populated.Then when the form is submitted it will be validated and then only when valid the form will be submitted.
We should probably also add a new prop for the
actionthat allows us to submit the form to a different URLLinks / References