EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: stephenl on December 31, 2023, 05:31:09 AM



Title: Form Load - First Array Element
Post by: stephenl on December 31, 2023, 05:31:09 AM
Regarding form data

In my case, the data returned is always a object, ie
$('#fm').form('load', [{name: 'xxx}]);

example of returned data
[
{"Company":"Company 1","Phone":"01234 567890","Email":"jim@yahoo.com"}
{"Company":"Company 2 ,"Phone":"01234 012345","Email":"bill@yahoo.com"}
]

I would like to use the email address, of the first element of the returned array data (in the above example "jim@yahoo.com" in a form field.

Suggestions appreciated

Thank you




Title: Re: Form Load - First Array Element
Post by: jarry on January 02, 2024, 06:48:04 PM
Call this code to load the email address of the first item.
Code:
$('#fm').form('load',{email:data[0].Email});