Implementing "more" functionality in formflow

108 Views Asked by At

Scenario, I have a field with 20+ possible values where the user needs to select 1, if I render all 20+ the screen scrolls up degrading the user experience.

Ideally, I would like to present 10 items at a time and an extra button so the user can select "more" or "next"/"prev", does anyone have a reference implementation on how this can be done in formflow?

(I guess it involves some validation and reprompt logic where I update the underlying values for the selection but I'm not sure how to go about it)

Thanks

1

There are 1 best solutions below

0
On

I have not tried this specific scenario, but I can think of two ways to do it.

  1. You could split your field into two fields, i.e. one which has an enumeration of the first 10 and a "more" choice and then a second field with the next 10. The second field would be conditional on the first field having a "more" value. This is the simplest method.

  2. The second way would be to make use of PromptAsyncDelegate and ValidateAsyncDelegate. The PromptAsyncDelegate would split up long lists of results to add a "More" button. You would write a ValidateAsyncDelegate which on "more" would return a ValidateResult that says the value is not valid and which has a FeedbackCard in it with the second batch of buttons. You could either build it in the code or you some private state to pass the extra buttons.

Please let us know which approach works best for you.