jsonform
Version:
Client-side JavaScript library that generates HTML forms from structured data models expressed using a JSON schema, possibly completed by a form layout description.
49 lines • 883 B
JavaScript
$("#testform").jsonForm({
"schema": {
"tabs": {
"type": "array",
"items": [{
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Tab title"
},
"thumbnail": {
"type": "array",
"title": "Tab thumbnails",
"items": {
"type": "string"
}
}
}
}]
}
},
"form": [
{
"type": "tabarray",
"items": [
{
"type": "fieldset",
"legend": "{{idx}}",
"items": [
"tabs[].name"
]
}
]
},
{
"type": "actions",
"items": [
{
"type": "submit",
"value": "Submit"
}
]
}
],
"onSubmit": function (errors,values) {
console.log(errors,values);
}
});