question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Embedding a 'react jsonschema' form inside another form

See original GitHub issue

I’ve been going over the docs and so far haven’t seen an obvious answer here, so I would like to just ask: How do you embed this <Form> into a normal <form> and override simple things like the ‘Submit’ button?

Obviously you can create a CustomForm like in the docs, but the submit button still comes along for the ride.

It would be great to have a way to break down the JSON schema into its component parts rather than having it try to handle everything

i.e.

const JsonEditorDemo = () => {
    const schemaForm = useJsonSchema({ schema, formData });

    return <form onSubmit={e => ...schemaForm.data }>
        ... your other custom form fields can go here, or you can use Formik, etc..
        <schemaForm.Editor />
        <button>submit</button>
    </form>
};

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
epicfaacecommented, May 29, 2020

You can override the submit button by passing something as a child to the <Form> component.

Interesting idea you bring up – but how do you think it would handle things like validation errors? For example, how would we display validation errors if we had formik embedded within rjsf?

0reactions
rlamoreacommented, Nov 16, 2021

Trying to do this as well (with Formik). I think it would be nice to just have the code to validate/retrieve the values out of the form programmatically without doing a submit. Then if my primary form is submitted, I can just programmatically call the JSON form to validate/capture the formData and deal with it as I like.

FWIW: I was not able to get programmatic submit to work at all (using MUI JSON form and Formik).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependencies - react-jsonschema-form documentation
Dependencies can be used to create dynamic schemas that change fields based on what data is entered. Property dependencies¶. This library supports conditionally ......
Read more >
react-jsonschema-form nested object fields on different levels
I would like to implement a form where each subfield/sub-object of a parent object is indented slightly more than its parent. Consider clicking ......
Read more >
lb-react-jsonschema-form - npm
A simple React component capable of building HTML forms out of a JSON schema.. Latest version: 1.2.1, last published: 3 years ago.
Read more >
Understanding JSON Schema
representing information about a person in JSON in different ways: ... a declarative format for “describing the structure of other data”.
Read more >
Create forms using the JSON Schema Form component
The JSON Schema Form component is based on the react-jsonschema-form library. You create a form by defining the inputs and behavior using JSON...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found