Hey guys,
I have a problem with dropdownfield which is placed into foreach loop. When I'm selecting the value from dropdown, the error message is showen.
The code in saveInto field is just verifying if the question should be showen and it is saving the question with answer to the interface input. You can ignore this saveInto field because I'm getting the same error even without it(check the last pic).
load( local!questionList: rule!CO_getQuestions( ri!QuestionnaireType ), with( a!forEach( items: local!questionList, expression: if( rule!CO_NeedToShowQuestion( fv!item, ri!answeredQuestions ), a!sectionLayout( contents: { a!dropdownField( label: fv!item.text, labelPosition: "ABOVE", placeholderLabel: "--- Select an Answer ---", choiceLabels: fv!item.options, choiceValues: fv!item.options, value: fv!item.answer, saveInto: { fv!item.answer, if( fv!item.answer = "", a!save( ri!answeredQuestions, remove( ri!answeredQuestions, rule!CO_getIndexOfEditedItem( ri!answeredQuestions, fv!item ) ) ), if( or( length( rule!CO_getIndexOfEditedItem( ri!answeredQuestions, fv!item ) ) = 0, rule!CO_getIndexOfEditedItem( ri!answeredQuestions, fv!item ) = {} ), a!save( ri!answeredQuestions, append( ri!answeredQuestions, fv!item ) ), a!save( ri!answeredQuestions[tointeger( rule!CO_getIndexOfEditedItem( ri!answeredQuestions, fv!item )[1] )], fv!item ) ) ) }, validations: {}, required: true ) } ), {} ) ) ) )
The Structure of fv!item is visible in interface input, This is the state after selecting the value in dropdown, so the answer is saved :
I don't know what's going on because the choosen value is in the choiceLabels and choiceValues arrays. Can you help me please ? Thank you
Discussion posts and replies are publicly visible
its array of text and both are the same