Search code examples
react-jsonschema-forms

react json schema form not sending empty value key


I am using react json schema form for form creation. I am trying to submit the form. When I am sending the empty value. Key is eliminted from the data. for example In a form, I have two fields Name and Address. Input name="abc" address=""

Output { name:abc }

Required output { name:abc, address: }


Solution

  • you can use defaults. try

    {
      "title": "A registration form",
      "description": "A simple form example.",
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "title": "name",
          "default": ""
        },
        "address": {
          "type": "string",
          "title": "address",
          "default": ""
        }
      }
    }