&stepTpl in renderForm - has it been removed?

I’ve just been taking a look at the latest version of Formalicious after upgrading from v1.3.0 to v1.4.4 and noticed that one of the parameters in the renderForm snippet has been removed :frowning_face:

The parameter that has been removed was &stepTpl.

I was using this to extend the default stepTpl chunk with a custom snippet to display custom step indicators, such as…

and

…which really made Formalicious feel complete.

Any chance this might be added back any time soon?

So, just been looking through the code, and it’s all been re-factored :slight_smile:

I guess my question then, is how do I override the stepTpl parameter that’s in FormaliciousHookRenderForm hook?

This was unintentional. We’ll have a look at it Thursday.

Thanks @Sterc!

Just to clarify, &stepTpl hasn’t been removed - it’s just been moved into a hook now, and i’ve found a way to override that particular default chunk :slight_smile: It just caught me off guard :slight_smile:

If renderForm snippet no longer has access to that parameter, I can work around it using different &formTpl.

It’s a great update btw! Great work!!

Hi @jonleverrier

A temporary fix is to change the following code in the FormaliciousHookRenderForm hook:

$stepTpl = $modx->getOption('stepTpl', $scriptProperties, 'stepTpl');
$stepParam = $modx->getOption('stepParam', $scriptProperties, 'step');

to:

$stepTpl = $modx->getOption('stepTpl', $formit->config, 'stepTpl');
$stepParam = $modx->getOption('stepParam', $formit->config, 'step');

And add the stepTpl to the FormIt call in your formTpl chunk:

&stepTpl=`chunkname`

Thank you @Oetzie!

I’ll give this ago, however it works without changing the current code :thinking:

If I just add &stepTpl=`chunkname` to formTpl - it works.

1 Like

Please add some documentation in the docs about these changes and how to fix them:

This is what I’ve learned so far:

stepTpl isn’t part of renderForm anymore. Instead it has to be added to formit: &stepTpl=my_stepTpl
On top of this you have to add &renderHooks=[[+renderHooks]] to your formit snippet:

[[!FormIt?
    &hooks=`[[+hooks]]`
    &preHooks=`[[+preHooks]]`
    &renderHooks=`[[+renderHooks]]`

    &stepTpl=`my_stepTpl`
    ....
]]
  1. You need to change the following placeholders:

Change form action attribute from

action="[[~[[*id]]? &[[!+stepParam]]=`[[!+currentStep]]`]" 

to:

action="[[!+formalicious.currentUrl]]#form"

Change form placeholder from:

[[!+form]]

to:

[[!+formalicious.form]]

Change *step placeholder from:

  [[!+currentStep:neq=`1`:then=`
<a class="btn btn-vb" href="[[~[[*id]]]]?[[!+stepParam]]=[[!+currentStep:decr=`1`]]#form">
   [[%formalicious.prev]]
</a>

to:

[[!+formalicious.step:neq=`1`:then=`
    <a 
        class="btn btn-vb" 
        href="[[!+formalicious.prevUrl]]#form"
        title="[[%formalicious.prev? &namespace=`formalicious` &topic=`default`]]"
    >
        [[%formalicious.prev? &namespace=`formalicious` &topic=`default`]]
    </a>
    `:else=``]]