We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32678
    • 290 Posts
    I'm setting up a multi-page form, following this post (https://forums.modx.com/thread/20183/how-to-multiple-page-form-in-modx-w-formit) from YJ (Sepia River).

    The snippet call and form is currently very simple, and uses only the redirect hook. It does not redirect from the first page to the second, but does from the second to third. When I submit the first page, which is on resource 1 + a named anchor, it redirects back to itself. Currently the form action element includes the named anchor - if I remove this the form redirects to resource 1.

    Just a note that I tested the retriever function with placeholders and the input value from page 2 carries to page 3, but not from page 1 to page 2.

    Here's what I have for the calls and forms:
    Page 1 (note the named anchor in the action element):
    [[!FormIt?
    	&hooks=`redirect`
    	&store=`1`
            &redirectTo=`46`
    	&validate=`name:required`
      ]]
      <form action="[[~[[*id]]]]#Welcome-to-Different/Lets-Talk" method="post" id="getStarted">
    	<input type="text" id="name" name="name" value="[[!fi.name]]" placeholder="Your Name" required aria-required-true="true" />
    	<input type="submit" value="Continue" class="button" name="go" />
      </form>


    Page 2:
    [[!FormIt?
        &hooks=`redirect`
        &store=`1`
        &redirectTo=`47`
        &validate=`URL:required`
    ]]
    [[!FormItRetriever]]
    <div class="section">
        <section class="small-2 columns">
          <p></p>
        </section>
        <section class="small-10 medium-8 large-6 small-centered text-left end columns">
          <p>What is your current website's URL?</p>
          <form action="[[~[[*id]]]]" method="post" id="getStarted-2">
            <input type="hidden" name="name" value="[[+fi.name]]" /> 
        	<input type="text" id="URL" name="URL" value="[[!fi.URL]]" placeholder="www.YourName.com" required aria-required-true="true" />
        	<input type="submit" value="Continue" class="button" name="go-2"/>
        	<input name="submitted" type="hidden" id="submitted" value="true" />
          </form>
    	  <p>[[+fi.name]]</p>
        </section>
    </div>


    Page 3:
    [[!FormIt?
        &hooks=`redirect`
        &store=`1`
        &redirectTo=`48`
        &validate=`email:email:required`
    ]]
    [[!FormItRetriever]]
          <form action="[[~[[*id]]]]" method="post" id="getStarted-3">
            <input type="hidden" name="name" value="[[+fi.name]]" /> 
    		<input type="hidden" name="URL" value="[[+fi.URL]]" /> 
        	<input type="email" id="email" name="email" value="[[!fi.email]]" placeholder="[email protected]" required aria-required-true="true" />
        	<input type="submit" value="Continue" class="button" name="go-3"/>
        	<input name="submitted" type="hidden" id="submitted" value="true" />
          </form>


    I am developing locally on XAMPP using 2.3.3. I have htaccess active and unaltered from the what ships (I've tried the form with htaccess inactive, as well). I am not using FURLs, and resources 46 and 47 are unnested in the tree.

    Thanks for any insights.
      • 32678
      • 290 Posts
      I tested the initial form from a different page and it works, so the issue is related to the use of the multi-page homepage.

      This is constructed using Resource #1 and four children. A pdoResources call in the parent resource calls in the children resource content. The jQuery plugin FullPage.js generates 'slides' of this content, enabling the single-page effect.

      The initial form is on the last child resource. Somehow this trips up the redirector hook, but in reality all content is rendered on resource 1.

      Also, as I mentioned in the previous post, the second and third form pages function. Both of those pages also use FullPage.js, so the plug-in is not the source of the FormIt issue.