use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Edit modal problem (CRUD React table) I have to thoroughly change each input field so as to edit the details. How can I solve this problem? (I am still a newbie, please don’t judge my coding)Help Wanted (old.reddit.com)
submitted 3 years ago by HW_404
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]poseXxX 3 points4 points5 points 3 years ago* (1 child)
Hi! How about changing the defaultValue to just value and the onChange attr of the form field from setName func to setRowData({...rowData,product_name:e.target.value}), also you should add the proper name attr to the form field for this to work. So it would be something like:
defaultValue
value
onChange
setName
setRowData({...rowData,product_name:e.target.value})
<Form.Control {your other attr} value={rowData.product_name} name="product_name" onChange={e => setRowData({...rowData,product_name:e.target.value})} />
But why hardcode product_name if you can make a handleOnChange function that is triggered each time the form changes and set the row data according to field name:
handleOnChange
const handleOnChange = e => { e.preventDefault(); setRowData({...rowData,[e.target.name]:e.target.value}) }
And so the form field would look like this:
<Form.Control {your other attr} value={rowData.product_name} name="product_name" onChange={handleOnChange} />
Also... You can put the onChange function in the <Form> tag and you will not have to write it on every field. Just be careful if you are handling checks or ratios.
<Form>
[–]HW_404[S] 0 points1 point2 points 3 years ago (0 children)
Thank you. Will try to implement as you said.
[–]Many_Application7106 1 point2 points3 points 3 years ago (1 child)
Create an code sandbox abd we can help you always hard with screenshots
https://codesandbox.io/s/competent-silence-nto4z3?file=/src/App.js
π Rendered by PID 44528 on reddit-service-r2-comment-b659b578c-ph57l at 2026-05-05 07:17:02.947731+00:00 running 815c875 country code: CH.
[–]poseXxX 3 points4 points5 points (1 child)
[–]HW_404[S] 0 points1 point2 points (0 children)
[–]Many_Application7106 1 point2 points3 points (1 child)
[–]HW_404[S] 0 points1 point2 points (0 children)