V
V
Vadim Yagofarov2020-06-26 16:41:13
JSON
Vadim Yagofarov, 2020-06-26 16:41:13

How to disable validation in react-jsonschema-form?

How to disable validation in react-jsonschema-form?

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    <link rel="shortcut icon" type="image/png" href="favicon.png">
    
  <link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css?7538">
  <link rel="stylesheet" type="text/css" href="style.css?7153">
  <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css">
  
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.13.1/umd/react.production.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.13.1/umd/react-dom.production.min.js"></script>
  <script src="https://unpkg.com/@rjsf/core/dist/react-jsonschema-form.js"></script>
  
    <title>Home</title>

<!-- Analytics -->
 
<!-- Analytics END -->
    
</head>
<body>
<!-- Main container -->
<div class="page-container">
    
<!-- bloc-0 -->
<div class="bloc l-bloc " id="bloc-0">
  <div class="container bloc-lg">
    <div class="row">
      <div class="col-sm-10 offset-sm-1 col-md-8 offset-md-2 col-lg-6 offset-lg-3">
        <div id="app"></div>
        
      </div>
    </div>
  </div>
</div>
<!-- bloc-0 END -->

<!-- ScrollToTop Button -->
<a class="bloc-button btn btn-d scrollToTop" onclick="scrollToTarget('1',this)"><span class="fa fa-chevron-up"></span></a>
<!-- ScrollToTop Button END-->


</div>
<!-- Main container END -->
    

<script src="./js/jquery-3.3.1.min.js?5100"></script>
<script src="./js/bootstrap.bundle.min.js?1213"></script>
<script src="./js/blocs.min.js?7089"></script>
<script src="./js/lazysizes.min.js" defer></script>
<!-- Additional JS END -->


<script>
  //let schema;

  const Form = JSONSchemaForm.default;
  console.log(Form);
  const onSubmit = ({ formData }) => console.log("Data submitted: ", formData);
  let yourForm;
  

  (async () => {
    const data = await fetch('http://localhost/lk-ssl/hs/json/forma_2')   // дописать параметры типа /url?param1=100
    const schema = await data.json();
    //console.log(schema); 

    ReactDOM.render(
    React.createElement(
      Form,
      { 
        schema: schema,
        onSubmit: onSubmit

вот эти параметры не помогли 
                                //liveValidate:false,
        //noHtml5Validate:true,
        //NOVALIDATE:true,
        //OnError:false,
      }
    ),
    document.getElementById("app"));
  })();
  
  
  


</script>

<!-- Preloader -->
<div id="page-loading-blocs-notifaction" class="page-preloader"></div>
<!-- Preloader END -->

</body>
</html>

If the data is filled in correctly, the data is not sent and an error message is displayed. Is it possible to somehow try to bypass the validation and try to send the data? Error message Errors
.properties['familiya'].required should be array
.properties['data_rozhdeniya'].required should be array
.properties['vozrast'].required should be array

Here is the json that comes
{
    "title": "Название формы",
    "type": "object",
    "properties": {
        "familiya": {
            "title": "Фамилия",
            "description": "Фамилия",
            "type": "string",
            "name": "familiya"
        },
        "data_rozhdeniya": {
            "title": "Дата рождения",
            "description": "Дата рождения",
            "type": "object",
            "name": "data_rozhdeniya",
            "properties": {
                "date": {
                    "type": "string",
                    "format": "date"
                }
            }
        },
        "vozrast": {
            "title": "Возраст",
            "description": "Возраст",
            "type": "number",
            "name": "vozrast"
        }
    },
    "required": [
        "Фамилия",
        "Дата рождения"
    ]
}


Made according to the examples from this site https://rjsf-team.github.io/react-jsonschema-form/

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question