0

We are using JSON Schema to Form library to embed a form inside a reactJS page. We want to set the form (generated from JSON schema) data into a input hidden value to be used later on to pass to a service to save the form value in the database.

e.g. See the formData highlighted in the image below attached. this needs to be set as a value to passed to save in the database column enter image description here

  • You can try to set `onChange` function to the form. This call wolud be receive same arguments as `onSubmit`. So in the arg you would have `formData`, you can set this to this value to hidden input. – Panther May 10 '20 at 13:14
  • We did try this, but the form (react-json-schem-form) gets reset to initial state upon any change in the form. We have a form inside which we have this react-json-schema-form, – Achyuthanand May 10 '20 at 13:32
  • Setting initialValues prop on SimpleForm/TabbedForm with hidden input values solves this? Or does the same problem with onChange happens? – gstvg May 10 '20 at 15:55
  • @gstvg "Setting initialValues prop on SimpleForm/TabbedForm with hidden input values solves this?" - sorry, can you elaborate please? not fully clear on this option you mentioned. – Achyuthanand May 11 '20 at 11:39
  • I assumed based on [react-admin] tag that the form resides inside a SimpleForm/TabbedForm. If so, may help. If not, apologize for my misunderstood – gstvg May 11 '20 at 17:46

0 Answers0