Multi page forms

These scribblings roughly describe the path that lead to multi page forms in FormBlocks. That's integrated and working now, but needs proper documentation still.

Add FormItRetriever to forms

[[splitString?
    &input=`[[+previous_steps]]`
    &options=``
    &delimiter=`,`
    &prefix=`step`
]]
[[!FormItRetriever?
    &placeholderPrefix=`fb[[+step.[[+step.last]]]].`
    &storeLocation=`session`
    &redirectToOnNotFound=`156`
]]
[[!fbFormReport? &formID=`[[+previous_steps]]` &tplPrefix=`fbStoreRow_`]]

Note: [[+previous_steps]] changed from being form IDs to being page IDs. Easier for editors, but I need to convert all the steps to form IDs in fbForm.

Set previous steps in CB

Comma separated list of page IDs.

Set next in CB

Single page ID. This is the redirectTo field. So the last step of the form should redirect to the thank you page here.

Experiment: do symlinks work?

[[!modifiedIf?
    &subject=`[[#[[+form_id]].class_key]]`
    &operator=`eq`
    &operand=`modSymLink`
    &then=`[[#[[+form_id]].content]]`
    &else=`[[+form_id]]`
    &toPlaceholder=`this_is_the_form_you_are_looking_for`
]]

Apparently not..

Update Saturday, 02. May 2020 01:29PM

It's all working and integrated now in Romanesco.

One thing to watch out for, is that autogenerated options sometimes have trouble repopulating previously selected options when navigating back and forth.

It seems to be happening only when using MigxLoopCollection to create the options. When running into issues, try adding some of the placeholders used to the snippet call with &addfields:

[[migxLoopCollection?
    &packageName=`FoodBrain`
    &classname=`foodSpecies`
    &tpl=`fbSelectDropdownRowInputOption`
    &addfields=`field_name:[[+field_name]],field_type:[[+field_type]],checkbox_type:[[+checkbox_type]]`
    &outputSeparator=``
    &sortConfig=`[{"sortby":"name","sortdir":"ASC"}]`
]]

A separate doc dedicated to the autogenerated options field would be nice as follow-up.

Update Saturday, 02. May 2020 01:37PM

Holy crap, I wrote that already :)