Hi all!
I'm very, very new to modx but enjoying it very much
I have a form with two steps. After the first form is completed, it gets redirected to another page where the user must login and then we should finish the second step to finish.
All is working fine when the user is logged in but when the user is logged in the form values are cleared and the user goes back to the first form.
First form:
[[!FormIt@bmiCalculatorv2? &hooks=`redirect` &submitVar=`submit-bmi` &clearFieldsOnSuccess=`No` &store=`1` &storeTime=`300000`] &redirectTo=`22`]
[[!FormItRetriever]]
<div class="calc-container">
<div class="atk-form">
<form action="[[~[[*id]]]]" method="post" enctype="application/x-www-form-urlencoded" name="bmiCalc" id="bmiCalc">
<fieldset>
<div class="red-radios">
<input type="radio" id="male" name="male">
<label for="male" class="small-label">[[%atkins.bmi.gender.male? &namespace=`atkinswidgets` &topic=`bmi`]]</label>
</div>
<div class="red-radios">
<input type="radio" id="female" name="female">
<label for="female" class="small-label">[[%atkins.bmi.gender.female? &namespace=`atkinswidgets` &topic=`bmi`]]</label>
</div>
<p class="hidden error" data-id="uniform-male,uniform-female">[[+fi.error.gender]]</p>
</fieldset>
<fieldset>
<label for="weight">[[%atkins.bmi.weight? &namespace=`atkinswidgets` &topic=`bmi`]]</label>
<input type="text" name="weight:required" id="weight" value="[[+fi.weight]]">
<span>kgs</span>
<p class="hidden error" data-id="weight" >[[+fi.error.weight]]</p>
</fieldset>
<fieldset>
<label for="height">[[%atkins.bmi.height? &namespace=`atkinswidgets` &topic=`bmi`]]</label>
<input type="text" name="height:required" id="height" value="[[+fi.height]]">
<span>cms</span>
<p class="hidden error" data-id="height">[[+fi.error.height]]</p>
</fieldset>
<div class="btn-red">
<span>
<input type="submit" name="submit-bmi" value="[[%atkins.bmi.calcbmi? &namespace=`atkinswidgets` &topic=`bmi`]]">
</span>
</div>
</form>
</div>
</div>
Form 2
[[!FormItRetriever? &placeholderPrefix=`fi.` &redirectToOnNotFound=`17`]]
[[!FormIt? &submitVar=`nextstep` &hooks=`spam,redirect` &store=`1` &redirectTo=`20` &validate=`goal_weight:required`]]
<div class="wrapper bmi-calc-results internal-page clearfix">
<div class="wrapper-medium">
<div class="text-block clearfix">
<h2>Form Step 2</h2>
</div>
<div class="text-block wider clearfix">
[[*longtitle:ne=``:then=`<h3>[[*longtitle:stripTags]]</h3>`]]
[[*introtext:ne=``:then=`<p>[[*introtext:stripTags]]</p>`]]
</div>
[[!LoggedInBMI]]
<!--END rect box-->
</div>
</div>
LoggedInBMI snippet
<?php
$ctxs = !empty($ctxs) ? $ctxs : $modx->context->get('key');
if (!is_array($ctxs)) $ctxs = explode(',',$ctxs);
if (!$modx->user->hasSessionContext($ctxs)) {
return '[[!Login@bmiLogin? &loginKey=`bmi-login` &loginResourceId=`22`]]';
}
return '[[$formBmiSaveResult]]';
formBmiSaveResult chunck
<div class="simple-form gradient-divider atk-form">
<form action="[[~[[*id]]]]" method="post" id="bmiStep3">
<input type="hidden" name="gender" value="[[+fi.gender]]" />
<input type="hidden" name="measurement_type" value="cms" />
<input type="hidden" name="current_weight" value="[[+fi.current_weight]]" />
<input type="hidden" name="current_height" value="[[+fi.current_height]]" />
<input type="hidden" name="bmi" value="[[+fi.calculated_bmi]]" />
<ul class="clearfix">
<li>
<label for="goal-value">[[%atkins.bmi.entergoalweight? &namespace=`atkins_widgets` &topic=`bmi`]]</label>
<input type="number" value="" name="goal_weight" id="goal-value" value="[[+fi.goal_weight]]">
<span class="sub-label">Kgs</span>
<li>
<span class="btn-red">
<span>
<input type="submit" name="nextstep" value="Save">
</span>
</span>
</li>
</ul>
</form>
</div>
So basically after the login all the values seem to be cleared from the cahce... Can anyone help?
Thanks