JavaScript/jQuery Form - Generate a Data Object from Form Items
Not only you can bind the Form to an existing data object, but you can also generate a new data object directly from the Form items. For this purpose, bind simple items from the items array to not-yet-existing data fields using the dataField property. Once a user enters a value into such an item, the corresponding data field is created in the data object. To obtain this data object, get the value of the formData property using the option(optionName) method.
JavaScript
- $(function() {
- $("#formContainer").dxForm({
- items: [{
- dataField: "firstName",
- editorType: "dxTextBox"
- }, {
- dataField: "lastName",
- editorType: "dxTextBox"
- }, {
- dataField: "birthDate",
- editorType: "dxDateBox"
- }],
- onFieldDataChanged: function(e) {
- var newFormData = e.component.option("formData");
- // ...
- }
- });
- });
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.