Form doesn't grab values after a submit
See original GitHub issueI have a form that looks like such:
<Form
onSubmit={approveAndList}
buttonConfig={{
isLoading: false,
type: "submit",
theme: "primary",
text: "Sell NFT!",
}}
data={[
{
value: "",
},
{
value: "",
},
{
value: "",
},
]}
title="Sell your NFT!"
id="Main Form"
/>
And a approveAndList
function that looks like such:
async function approveAndList(data: any) {
console.log(data.data[0].inputResult)
console.log(data.data[1].inputResult)
console.log(data.data[2].inputResult)
}
In my UI, I have this for the form:
On the first submit, I’ll be able to console.log out the correct variables from the form.
Now, if I don’t touch the form, the UI will still have those values in their fields, but in the code they will show up as blank and I have to reenter them even though the UI shows the fields still populated.
Could we have these by default grab whenever value is in them? Or have them cleared anytime a form is submitted?
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Cannot get POST value of submitted form - Stack Overflow
The problem is disabled fields are not submitted. <input type="text" name="recipientemail" value="email@email.com" disabled />.
Read more ><input type="image"> - HTML: HyperText Markup Language
A string indicating the HTTP method to use when submitting the form's data; this value overrides any method attribute given on the owning...
Read more >How to Prevent a Form from Clearing Fields on Submit
This video is a sample from Skillsoft's video course catalog. In JavaScript, you can use HTML forms for all sorts of purposes but...
Read more >submit - Cypress Documentation
If the form being submitted includes inputs with client-side validation and that validation fails, .submit() will fail and list the validation failures. Rules....
Read more >How to Get the Value of a Form Input on Submit in React
The button element in the form has a type of submit , so every time the user clicks it, the submit event is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Glad to add helpful issues to keep improving this much needed project!!
nice suggestion @rayyan224 TY
Ty for the report Patrick!
I was also going to add that on successful return of the data I had expected that you would perform some action that would remove the form and maybe render a nice message perhaps?
Either way you can track the pull request i just opened. It will disable the submit button after its clicked and the data is successfully returned. At least now you can’t get the empty data, which was buggy for sure. Also just FYI this is a minimal change because I plan to refactor Form soon and I don’t want to push too many breaking changes as traction on the kit is really heating up.
Thanks for using the kit and reporting the issue @PatrickAlphaC you are a valued member of the web3uiKit community 😁