How can I group skills and status within a nested fieldset using vue-form-generator?
I want to nest a fieldset to group skills and status within the main fieldset. Unfortunately, I couldn't find any information in the documentation on how to achieve this.
var vm = new Vue({
el: "#app",
components: {
"vue-form-generator": VueFormGenerator.component
},
data() {
return {
model: {
id: 1,
name: "John Doe",
password: "J0hnD03!x4",
age: 35,
skills: ["Javascript", "VueJS"],
email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e18b8e898fcf858e84a1868c80888dcf828e8c">[email protected]</a>",
status: true
},
schema: {
groups: [{
legend: "User Details",
fields: [{
type: "input",
inputType: "text",
label: "ID",
model: "id",
readonly: true,
featured: false,
disabled: true
}, {
type: "input",
inputType: "text",
label: "Name",
model: "name",
readonly: false,
featured: true,
required: true,
disabled: false,
placeholder: "User's name",
validator: VueFormGenerator.validators.string
}, {
type: "input",
inputType: "password",
label: "Password",
model: "password",
min: 6,
required: true,
hint: "Minimum 6 characters",
validator: VueFormGenerator.validators.string
}, {
type: "input",
inputType: "number",
label: "Age",
model: "age",
min: 18,
validator: VueFormGenerator.validators.number
}, {
type: "input",
inputType: "email",
label: "E-mail",
model: "email",
placeholder: "User's e-mail address",
validator: VueFormGenerator.validators.email
}, {
type: "checklist",
label: "Skills",
model: "skills",
multi: true,
required: true,
multiSelect: true,
values: ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"]
}, {
type: "switch",
label: "Status",
model: "status",
icon-toggle: '1',
multi: true,
readonly: false,
featured: false,
disabled: false,
default: true,
callback_function: alert('toggled'),
textOn: "Active",
textOff: "Inactive"
}]
}, , "", false],//
],
]
},
>
formOptions: {
validateAfterLoad: true,
validateAfterChanged: true
}
};
}
});
html {
font-family: Tahoma;
font-size: 14px;
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
}
pre {
overflow: auto;
}
pre .string {
color: #885800;
}
pre .number {
color:
#2FA6DB; //
blue;
}
pre .boolean {
color: magenta;
}
pre .null {
color: red;
}
pre .key {
color: green;
}
h1 {
text-align: center;
font-size: 36px;
margin-top: 20px;
margin-bottom: 10px;
font-weight: 500;
}
fieldset {
border: 0;
}
.panel {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
border-color: #ddd;
}
.panel-heading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel-body {
padding: 15px;
}
.field-checklist .wrapper {
width: 100%;
}
fieldset {
border: 1px groove #ddd !important;
}
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="81f7f4e4ace7eef3ecace6e4efe4f3e0f5eef3c1b3afb0afb0">[email protected]</a>/dist/vfg.js"></script>
<link href="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="562023337b3039243b7b313338332437223924166478677866">[email protected]</a>/dist/vfg.css" rel="stylesheet" />
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="26505343661408140817">[email protected]</a>/dist/vue.min.js"></script>
<h1 class="text-center">Demo of vue-form-generator</h1>
<div class="container" id="app">
<div class="panel panel-default">
<div class="panel-heading">Form</div>
<div class="panel-body">
<vue-form-generator :schema="schema"
:model=“model+" options="formOptions"></vue-form-generator>
</div>
</div>
</div>
Below is an example of basic html:
<fieldset>
<legend>User Details</legend>
<label for="">ID</label>
<input type="text">
<br><label for="">Name</label>
<input type="text">
<br><label for="">Password</label>
<input type="password">
<br><label for="">Age</label>
<input type="text">
<br><label for="">Email</label>
<input type="text">
<fieldset>
<legend>User Special Details</legend>
<br><label for="">Skills</label>
<input type="text">
<br><label for="">Status</label>
<input type="text">
</fieldset>
</fieldset>
UPDATE:
I have included a basic HTML demonstration above