formcreator icon indicating copy to clipboard operation
formcreator copied to clipboard

Redirect to next form

Open xacobofg opened this issue 4 years ago • 7 comments

Changes description

Adds the possibility to redirect to another form when a form is completed.

xacobofg avatar Mar 15 '21 13:03 xacobofg

Hi @btry I changed the order of the fields. What do I have to modify in the test file?

xacobofg avatar Mar 18 '21 09:03 xacobofg

Hi

Check the test execution log of your PR (latest run is here : https://github.com/pluginsGLPI/formcreator/pull/2173/checks?check_run_id=2119989310)

Exporting a form is broken because you aded a new field. Tests need to be updated to to recognize this new field

image

Also as the new field is a foreign key to a form, you need to add logic to

  • convert a form ID into an UUID on export
  • convert an UUID into a form ID on import.

See the export and import methods of PluginFormcreatorForm to apply those changes. This feature is implemented in a rather compicated way. If you don't understand well how it works, I'll handle this, but it may take time before I find enough time for tis task. The target version for your feature is 2.12.0.

btry avatar Mar 18 '21 09:03 btry

Hi @btry I modified the tests but it failed again. Can you tell me what needs to be modified?

xacobofg avatar Mar 18 '21 15:03 xacobofg

I need to push this contribution to a later version : a few things to solve before to merge

  • import of forms
  • deletion of forms
  • infinite loops across linked forms

btry avatar Jun 22 '21 12:06 btry

Hello,

I think we should add conditions to determine whether or not it redirects to the next form, in the same way as for targets. or choose which form to redirect to via the answer to a question.

tguichard25 avatar Oct 21 '21 12:10 tguichard25

Hi

for now there is an important problem with this feature. some users will use it a lot, and there is a risk of infinite loop. For example 3 forms A,B and C with A next B next C.

This is the main reason i did not merge this feature. It is incomplete for now and I don't had enough time to add code to avoid such loop.

btry avatar Oct 21 '21 12:10 btry

Infinite loops could be prevented by maintaining a list of form IDs in the chain and passing this to each target form. This list could be checked to see whether the next target form has already been a target in the chain and the chain stopped with an error.

derry43 avatar Apr 03 '22 08:04 derry43