Skip to content

Modify Form Data

This guide explains different methods for modifying form data, including using v-model, formData, setValue, and coverValue methods.

Modify Form Data Through v-model

Using v-model conveniently binds form fields and data for two-way binding. With v-model, user input automatically updates the data model, and data model changes are reflected in the form in real-time.

Note

Setting option.forceCoverValue = true can enable the force cover feature. By default, undefined field values will not be overwritten.

Set Form Default Values Through formData

The option.formData configuration allows you to set default values when the form is initialized. By passing a data object to formData, default values can be applied to fields in the form, ensuring the form has preset values when loaded.

Modify Form Data Through setValue Method

The setValue method provides a flexible way to modify form data. You can use the setValue method to set the value of the entire form or set the value of a specific field individually. This method is suitable for scenarios where you need to dynamically update data after the form is rendered.

Overwrite Form Data Through coverValue Method

The coverValue method allows you to completely overwrite the current values of the form with new data. Unlike setValue, the coverValue method will replace all data in the form, not just some fields. It is suitable for scenarios where you need to completely reset form data.

FormCreate is an open-source project released under the MIT License. Free for personal and commercial use.