Conditionally running FormIt Hooks based off input values

I saw this forum post and I think it is similar to what I’m trying to do, but not really.

The idea is that we have a form that works as a generic lead form, but one of the inputs has something like “I’ve spoken with a representative previously”. If that checkbox is checked, then it should redirect and auto fill the same fields from the first form into the next one. If that isn’t checked, it should go through the usual “FormItSaveForm,email,redirect” hook flow.

I was thinking it might be possible to just have a redirectIf custom hook that checks if a value is present.

<!-- pseudo code -->
[[!FormIt?
    &hooks=`FormItSaveForm,redirectIf,email, redirect`
    &if.inputName=`value==redirectId,value2==redirect2`
]]

I was thinking if redirectIf did the redirect, the hooks after wouldn’t run, do I have that right?

I think it depends on how you do the redirect.

If you just call the redirect hook, then it won’t work, as in this case the redirect is only done after all hooks ran successfully.
For example if you have a FormIt tag like this:

[[!FormIt? 
   &hooks=`redirect,myCustomHook` 
   ...
]] 

myCustomHook will still run, although it’s positioned after the redirect hook.