Vue UI Components Documentation
The Vue Form builds a form from a JSON template of fields, groups and buttons, with layout and validation. This guide adds the Vue Form (jqxForm) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxform.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxForm from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxform.vue';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
With <script setup>, an imported component is ready to use in the template. jqx.base.css is required; the second file is a theme, selected with the theme attribute.
The Default Functionality demo as a Single-File Component:
<template>
<JqxForm ref="myForm" style="width: 400px; height: auto" :template="template" :value="value">
</JqxForm>
</template>
<script setup>
import { ref } from 'vue';
import JqxForm from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxform.vue';
const template = ref([
{
bind: 'firstName',
type: 'text',
label: 'First name',
required: true,
labelWidth: '85px',
width: '250px',
info: 'Enter first name',
infoPosition: 'right'
},
{
bind: 'lastName',
type: 'text',
label: 'Last name',
required: true,
labelWidth: '85px',
width: '250px',
info: 'Enter last name',
infoPosition: 'right'
},
{
bind: 'company',
type: 'text',
label: 'Company',
required: false,
labelWidth: '85px',
width: '250px'
},
{
bind: 'address',
type: 'text',
label: 'Address',
required: true,
labelWidth: '85px',
width: '250px'
},
{
bind: 'city',
type: 'text',
label: 'City',
required: true,
labelWidth: '85px',
width: '250px'
},
{
bind: 'state',
type: 'option',
label: 'State',
required: true,
labelWidth: '85px',
width: '250px',
component: 'jqxDropDownList',
options: [
{ value: 'California' },
{ value: 'New York' },
{ value: 'Oregon' },
{ value: 'Illinois' },
{ value: 'Texas' }
]
},
{
bind: 'zip',
type: 'text',
label: 'Zip code',
required: true,
labelWidth: '85px',
width: '250px'
},
{ type: 'blank', rowHeight: '10px' },
{
columns: [
{ type: 'button', text: 'Sign up', width: '90px', columnWidth: '50%', align: 'right' },
{ type: 'button', text: 'Cancel', width: '90px', columnWidth: '50%' }
]
}
]);
const value = ref({
firstName: 'John',
lastName: 'Scott',
address: '1st Ave SW',
city: 'San Antonio',
state: 'Texas',
zip: '78209'
});
</script>Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, formDataChange:
<script setup>
function onFormDataChange(event) {
console.log(event.args);
}
</script>
<template>
<JqxForm @formDataChange="onFormDataChange" />
</template>
Call methods through a template ref. For example, val: Sets or gets the value of the object to bind to the form.
<script setup>
import { ref, onMounted } from 'vue';
const myForm = ref(null);
onMounted(() => {
const value = myForm.value.val(value);
console.log(value);
});
</script>
<template>
<JqxForm ref="myForm" />
</template>
Every component also has setOptions({ … }) and getOptions('name').