async await for default value
async await for default value
aazwar
Posts: 1Questions: 1Answers: 0
I've tried async await for default value, but it doesn't work
{ label: 'Number', name: 'number',
async def() {
let resp = await fetch('{{@BASE}}/ajax/reference/new-id?type=' + type);
return resp;
}
},
The corresponding input in the editor contains '[object Promise]'
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
The
field.def
option does not accept a promise in return. What you would need to do is useinitCreate
to trigger your Ajax request and then write tofield().val()
to set the field when it is complete.Allan