1# @ohos.application.formBindingData (formBindingData)
2
3The **FormBindingData** module provides APIs for widget data binding. You can use the APIs to create a **FormBindingData** object and obtain related information.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8> This module is deprecated since API version 9. You are advised to use [FormBindingData](js-apis-app-form-formBindingData.md) instead.
9## Modules to Import
10
11```ts
12import formBindingData from '@ohos.application.formBindingData';
13```
14
15## FormBindingData
16
17Describes a **FormBindingData** object.
18
19**System capability**: SystemCapability.Ability.Form
20
21| Name| Type| Mandatory| Description|
22| -------- | -------- | -------- | -------- |
23| data | Object | Yes| Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format.|
24
25
26## createFormBindingData
27
28createFormBindingData(obj?: Object | string): FormBindingData
29
30Creates a **FormBindingData** object.
31
32**System capability**: SystemCapability.Ability.Form
33
34**Parameters**
35
36| Name| Type          | Mandatory| Description                                                        |
37| ------ | -------------- | ---- | ------------------------------------------------------------ |
38| obj    | Object\|string | No  | Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format. The image data is identified by **'formImages'**, and the content is multiple key-value pairs, each of which consists of an image identifier and image file descriptor. The final format is {'formImages': {'key1': fd1, 'key2': fd2}}.|
39
40
41**Return value**
42
43| Type                               | Description                                   |
44| ----------------------------------- | --------------------------------------- |
45| [FormBindingData](#formbindingdata) | **FormBindingData** object created based on the passed data.|
46
47
48**Example**
49
50```ts
51import formBindingData from '@ohos.application.formBindingData';
52import fs from '@ohos.file.fs';
53import Base from '@ohos.base';
54
55try {
56  let fd = fs.openSync('/path/to/form.png');
57  let formImagesParam: Record<string, object> = {
58    'image': fd
59  };
60  let createFormBindingDataParam: Record<string, string | Object> = {
61    'name': '21°',
62    'formImages': formImagesParam
63  };
64
65  formBindingData.createFormBindingData(createFormBindingDataParam);
66} catch (error) {
67  console.error(`catch error, error: ${JSON.stringify(error as Base.BusinessError)}`);
68}
69```
70