-
-
Notifications
You must be signed in to change notification settings - Fork 129
Form Builder GUI APIs
Right now, in order to use APIs, you need to set a reference for form-builder
like this by using ref
prop:
<form-builder type="gui" :form="formData" v-model="formValues" ref="FormGui"></form-builder>
Access API in your method:
methods: {
getValue() {
// retrieve form values data
let value = this.$refs.FormGui.getValue();
}
}
Access:
this.$refs.FormGui.getValue();
An object of form values data will be return.
Note: for best practice, I suggest you should use v-model
instead.
Access:
this.$refs.FormGui.setValue(object formValues);
You need to pass your data object, and Form Builder will fill to the specific control for you.
Note: for best practice, I suggest you should use v-model
instead.
Access:
this.$refs.FormGui.validate(boolean showError);
A boolean will be return:
- True: form is ok, passed validation.
- False: not pass validation.
By default, showError is true, when you run validation, if there're any errors, a Toast message will be showed up (image demo below). If you don't want to show the default Toaster, set false instead.
The specific control that not passed validation will be set a red border, demo:
Access:
this.$refs.FormGui.clearError();
This API will help you clear all the red border of controls.
Want more API? Feel free to tell me, I will consider if it's a must API, I'll add it right away :D
Copyright © by Seth Phat aka Phat Tran Minh - http://sethphat.com
- Home