Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hello forum, I would have a question regarding multiple forms and back button....
I built a form with 5 steps....
in step 1 there 1 out of 4 choices to be made..
in step 2, depending on the choice in the step1, there are 4 different drop downs with different options....
steps 3,4 and 5 are same for all choices...
The problem is, that if I press back button in the step 3, it takes me back to one of the 4 drop downs (the one that is last nested), which is not "filtered" by the choice made in the step 1 (those nested if conditions in step 2)

I would like back button in step 3 to take me back to the drop down which is really used, means, which matches the drop down that matches the choice in the step 1...

If this is too complicated, a back button that comes back to step 1 would also be ok.....

I send the code here if anyone could help....that would be great

Tanja

Code: Select all

<cms:form anchor='0' method='post'>
       <!-- Set the total number of steps (sub-forms) in this form -->
       <cms:set total_pages = '5' />
     <!--
      Embed the PHP code that does all the grunge work in background.
      IMP. This has to come after we have set the 'total_pages', as above.
   -->
       <cms:embed 'multi_form_handler.html' />
   
         <cms:if k_current_step gt total_pages >
      <p>Form is submitted</p>
Values:          <!-- This is the 'success' condition of our form. -->
         <cms:else />     

<cms:if k_current_step='1' >
    <cms:fieldset class="option">
      <cms:input
         name='course'
           type='dropdown'
           label='choose a course'
           opt_values='-------=- | master | hobby| crash | teachers'
            opt_selected = '-------'
           required='1'
           class="line2"
           />
      <cms:if k_error_course ><span style="color:red"><cms:show k_error_course /></span></cms:if>
      </cms:fieldset>
</cms:if>
            <cms:if k_current_step='2' >
                 <!-- The markup for your first sub-form -->
          <!--1st condition--><cms:if frm_course='master'>
    <cms:fieldset class="option">
      <cms:input
         name='instrument'
           type='dropdown'
           label='Choose an Instrument'
           opt_values='---------=- | inst1 | inst2 | inst3 | inst4 | inst5 | inst6  '
            opt_selected = '---------'
           required='1'
           class="line2"
           />
      <cms:if k_error_instrument ><span style="color:red"><cms:show k_error_instrument /></span></cms:if>
      </cms:fieldset>
    <cms:else/>
        <!--2st condition--><cms:if frm_kurs='hobby'>
     <cms:fieldset class="option">
      <cms:input
         name='instrument'
           type='dropdown'
           label='Wählen Sie ein Instrument'
           opt_values='hobby inst=- | inst1 | inst2 | inst3 | inst4 | inst5 | inst6  '
            opt_selected = 'hobby inst'
           required='1'
           class="line2"
           />
      <cms:if k_error_instrument ><span style="color:red"><cms:show k_error_instrument /></span></cms:if>
      </cms:fieldset>
  <!--end of condition -->
  <cms:else />
      <!--3rd condition--><cms:if frm_kurs='crash'>
     <cms:fieldset class="option">
      <cms:input
         name='seminar'
           type='dropdown'
           label='Choose seminar'
           opt_values='crash seminar=- | long titel 1 | long titel 2 | long titel 1'
            opt_selected = 'crash seminar'
           required='1'
           class="line2"
           />
      <cms:if k_error_seminar ><span style="color:red"><cms:show k_error_seminar /></span></cms:if>
      </cms:fieldset>
  <!--end of condition -->
  <cms:else/>
      <!--4th condition-->
     <cms:fieldset class="option">
      <cms:input
         name='teachercourse'
           type='dropdown'
           label='choose an inst'
           opt_values='Teacher inst=- | inst1  | inst2 | inst3'
            opt_selected = 'Teacher inst'
           required='1'
           class="line2"
           />
      <cms:if k_error_teachercourse ><span style="color:red"><cms:show k_error_teachercourse /></span></cms:if>
      </cms:fieldset>
  </cms:if>
  </cms:if>
  </cms:if>
<!--end of step 2--></cms:if>
     
      <cms:if k_current_step='3' >
    <cms:if (frm_instrument='inst2' || frm_instrument='inst3' || frm_instrument='inst6')>
    <cms:fieldset class="option">
      <cms:input
         name='reservation'
           label='Tell us if you bring your inst or should we provide one?'
           opt_values='I have an inst | I do not have an inst'
            opt_selected='0'
           required='1'
           type='radio'
           id='reserve'
           />
      <cms:if k_error_reservation ><span style="color:red"><cms:show k_error_reservation /></span></cms:if>
      </cms:fieldset>
      <cms:else/>
      <cms:input type='hidden'
      name='otherinst'
      opt_values='no_need'
      />
  You do not need to make a reservation. Please go to the next step
      </cms:if>
   </cms:if>
     
            <cms:if k_current_step='4' >
                 <!-- The markup for your second sub-form --> 
          <div class="formchoice">Choose a date</div>
         <div class='datum'>
          <cms:input
          name='termin'
          type='radio'
          opt_values='07. 01. - 11. 01. | 25. 03. - 29. 03. | 06. 05. - 10. 05. '
          required='1'
          id='termin'
          class='termin'
          />
          </div> <br />
              </cms:if>
         
           
            <cms:if k_current_step='5' >
      STEP 5
                 <!-- The markup for your third sub-form --> 
              </cms:if>
     
           
            <!--
         Navigation with 'Next' and 'Previous' buttons.
         IMP! The button that navigates back has to be named 'back'
      -->
            <p class="nav">
                 <cms:if k_current_step gt '1'><input type="submit" name="back" value="Previous"></cms:if>
                 <input type="submit" name="next" value="<cms:if k_current_step=total_pages>Finish<cms:else />Next</cms:if>">
              </p>
      </cms:if>
  </cms:form>


Hi Tanja,

I noticed that you are using incorrect field names while checking for the selected option - e.g.
<cms:if frm_kurs='hobby'> should actually be <cms:if frm_course='hobby'>.

Apart from that, I have made some changes to the original multi_form_handler.html script. Please download it again from its original location at
viewtopic.php?p=9596#p9596
and use it by placing it in your snippets folder (thus overwriting the previous version).

Please let me know if this solves the problem.

Thanks.
Hello Kamran,

yes, that solves the problem :-)
Thanks a lot again!!!!


the mistake with the names in my posted code, happened because I wanted to translate names in english so that it would be easier to follow....I´ll correct that later....

many greetings

Tanja
3 posts Page 1 of 1
cron