我正在尝试jsonform
在我的 ASP.NET Core 应用程序中使用。它工作得很好。我不明白为什么我有这个错误
未捕获的错误:JSONForm 包含类型未知的元素:formTree.buildFromLayout (jsonform.js:3300) 处的“VerticalLayout”
@{
ViewData["Title"] = "Home Page";
}
<div id="test3"></div>
@section Scripts {
<script src="~/lib/underscore.js/underscore.js"></script>
<script src="~/lib/jsonform/jsonform.js"></script>
<script type="text/javascript">
$('#test3').jsonForm({
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"dead": {
"type": "boolean"
},
"kindOfDead": {
"type": "string",
"enum": [
"Zombie",
"Vampire",
"Ghoul"
]
},
"vegetables": {
"type": "boolean"
},
"kindOfVegetables": {
"type": "string",
"enum": [
"All",
"Some",
"Only potatoes"
]
}
}
},
"form": [
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"label": "Name",
"scope": "#/properties/name"
},
{
"type": "Group",
"elements": [
{
"type": "Control",
"label": "Is Dead?",
"scope": "#/properties/dead"
},
{
"type": "Control",
"label": "Kind of dead",
"scope": "#/properties/kindOfDead",
"rule": {
"effect": "ENABLE",
"condition": {
"scope": "#/properties/dead",
"schema": {
"const": true
}
}
}
}
]
},
{
"type": "Group",
"elements": [
{
"type": "Control",
"label": "Eats vegetables?",
"scope": "#/properties/vegetables"
},
{
"type": "Control",
"label": "Kind of vegetables",
"scope": "#/properties/kindOfVegetables",
"rule": {
"effect": "HIDE",
"condition": {
"scope": "#/properties/vegetables",
"schema": {
"const": false
}
}
}
}
]
}
]
}
]
});
</script>
}
此外,如果我按下按钮提交表单,验证似乎不起作用。我希望在ProjectTitle字段上看到一个弹出窗口。