Hey @Guillaume_Cisco I got the following error after updating to version 8.0.5 and running my app, is this something you have seen before ?
/Users/camillefeghali/dev/foxxbee/forest-api/node_modules/forest-express/dist/services/exposed/abstract-records-service.js:20
if (!params.timezone) throw new Error('Missing timezone in parameters');
^
TypeError: Cannot read property 'timezone' of undefined
/Users/camillefeghali/dev/foxxbee/forest-api/node_modules/forest-express/dist/services/exposed/abstract-records-service.js:20
if (!params.timezone) throw new Error('Missing timezone in parameters');
^
TypeError: Cannot read property 'timezone' of undefined
at new AbstractRecordService (/Users/camillefeghali/dev/foxxbee/forest-api/node_modules/forest-express/dist/services/exposed/abstract-records-service.js:20:17)
at RecordCreator._createSuperInternal (/Users/camillefeghali/dev/foxxbee/forest-api/node_modules/forest-express/dist/services/exposed/record-creator.js:15:317)
at new RecordCreator (/Users/camillefeghali/dev/foxxbee/forest-api/node_modules/forest-express/dist/services/exposed/record-creator.js:30:19)
at Object.<anonymous> (/Users/camillefeghali/dev/foxxbee/forest-api/controllers/answers.js:20:23)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at /Users/camillefeghali/dev/foxxbee/forest-api/node_modules/require-all/index.js:56:46
at Array.forEach (<anonymous>)
at requireAll (/Users/camillefeghali/dev/foxxbee/forest-api/node_modules/require-all/index.js:34:9)
at createServer (/Users/camillefeghali/dev/foxxbee/forest-api/server.js:40:3)
at Object.<anonymous> (/Users/camillefeghali/dev/foxxbee/forest-api/app.js:9:13)
Seems to be caused by const recordCreator = new RecordCreator(Answer); in my controllers/answers.js file,
Hey @Guillaume_Cisco I don’t know where to start, that’s why I’m reaching out I guess. I know how to get the data I would like to display, I just don’t know how to bind it to the fields object being returned from the load hook, should I place it in a particular key ?
Currently, if I log the fields object, I can see that it holds the following data:
fields: [
{
field: 'required-answer',
description: 'You can only see answers which are answers to previous questions',
reference: 'Answer.id',
type: 'String',
isRequired: true,
position: 0,
defaultValue: null,
enums: null,
widgetEdit: { name: 'belongsto dropdown', parameters: {} },
value: null
}
]
Now ideally, I would like to display a field (value), and when I hit submit, I would like send over the Id to my route.
If I do requiredAnswerField.enums = answers.map((answer) => answer.id);, then the UI shows Ids, and if I do equiredAnswerField.enums = answers.map((answer) => answer.value);, the UI would display what I want, but then would send over the value to my route and not the Id of the record.
Hum, indeed, if you need the value and the id, maybe you could also add a change hook who can fill the value of the field, with the answer selected. This way you could know the id of the selected answer.
That’s ok, could you explain to me the logic of using a onChange hook to send over the ID again please ? I thought I had it understood but I cannot seem to persist data across hooks
After some testing, I came to the conclusion it is not possible right now by using the Enum type.
By definition, your Enum values should be unique, so you should be able to retrieve them from your route with: