We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22197
    • 40 Posts

    Two forms on one and the same page. That should be no problem.

    But do try the following code - and have it executed on a modx installation with formit 4.0.

    [[!formit? &hooks=`redirect` &store=`1` &redirectTo=`90` &submitVar=`foo`]]
    <form id="form1" action="[[~[[*id]]]]" method="post">
        <input type="submit" name="foo" class="btn btn-primary" value="Submit Inquiry">
    <p>Something else</p>
    [[!formit? &hooks=`redirect`  &store=`1` &redirectTo=`90` &submitVar=`bar`]]
    <form id="form2" action="[[~[[*id]]]]" method="post">
        <input type="submit" name="bar" class="btn btn-primary" value="Submit Inquiry">

    The first submit button executes the redirect. The second one doesn't do anything.

    Is that a bug?

    KInd regards


    This question has been answered by joekekloosterman. See the first response.

    • discuss.answer
      • 51272
      • 7 Posts
      This is indeed a bug introduced in 4.0, where we rewrote the FormIt snippet to use the getService method instead of loadClass. This is fixed now and will be available in the next release.
        • 3749
        • 24,544 Posts
        Joeke, you might consider changing the array declarations back to the older style so they will still work for people with older versions of PHP. AFAIK, the older style has not been deprecated.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting