Choice that was filtered out of items to choose from does not appear in submitted data

Hi to all,

I faced a weird problem here and solve it with a workaround.

Today I got the same on another form and I tried to investigate the source of the problem.

If I have a select_one with a choice_filter, the selected option value appears empty in submissions data. But, if I calculate the label of the selected option, it appears.
Here is a simple form with a choice_filter and the submitted data. Simply remove the choice_filter to get it "work".
The common point between the 2 forms may be in the choice_filter that list values that have not already been selected.
But the choice filter seems to be ok because the shown options are the expected ones...
What can be wrong with it ?

1 Like

What's going on is that when the form is finalized, the choice list is recomputed for every select and values that are no longer available are cleared. By finalization time, the accumulator (previously_selected_strc in your case) includes every single selection ever made and so all answers are cleared.

It's possible that there's been a change of behavior here but I don't think so. When I've written this kind of form, I've always explicitly made sure the choice_filter includes the choice for the current repeat instance.

For example, this form has the following choice_filter:

name = current()/. or not(selected(join(" ", /select-no-duplicates/repeat/option), name))

I think you could add name = current()/. or to your existing condition to get the behavior you want.

Your form does point to a bug. When the value for a select is cleared because its choice no longer is available, any calculates that reference that value should be updated. Basically, your workaround is not supposed to work. :grimacing:

Thanks @LN !

Not the one I thought :grinning:

I'll try it on friday and I'll tell you.
This form is very promising and important for the field season to come...
Take your time to fix the bug :grinning:

1 Like

It works @LN. Thanks a lot for your explanation.

1 Like

how to replicated this for form using external csv as choice list?