json-forms icon indicating copy to clipboard operation
json-forms copied to clipboard

Validation is not working if form is not filled

Open sandeepbhatt opened this issue 8 years ago • 4 comments

Hi , I am using brutusin:json-forms in my project to create form dynamically. But I have found one issue with validation. If form is empty then validation is not working for below json JSON Data=>

{
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}

Please help me to fix this issue.

sandeepbhatt avatar Jul 19 '17 05:07 sandeepbhatt

if empty,the required fields are not okay,so it can't validate ?!? i didn't understood?

fabifabi avatar Jul 19 '17 09:07 fabifabi

Validation is not working if no fields are filled in the form. the form is generated through above JSON schema in http://brutusin.org/json-forms/.

sandeepbhatt avatar Jul 20 '17 05:07 sandeepbhatt

Hi,

Any Update ??

sandeepbhatt avatar Jul 24 '17 05:07 sandeepbhatt

just happened it to me, fixed! just find that line if (parentObject[prop] !== null) { replace with if (parentObject[prop] == null) { and it will work, cheers!

geoshar avatar Aug 09 '17 00:08 geoshar