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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```ts 12import formBindingData from '@ohos.app.form.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.app.form.formBindingData'; 52import fs from '@ohos.file.fs'; 53 54try { 55 let fd = fs.openSync('/path/to/form.png'); 56 let obj = { 57 'temperature': '21°', 58 'formImages': { 'image': fd } 59 }; 60 formBindingData.createFormBindingData(obj); 61} catch (error) { 62 console.error(`catch error, code: ${error.code}, message: ${error.message}`); 63} 64``` 65