We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42503
    • 120 Posts
    Hi,
    My basic problem is that I have 2 forms in a single page, what is happening when I hit submit in one form, the other form also get trigger. So the data are posting in wired format, mixing all the things.

    If there is any way out, so that I can use 2 forms.

    Thank you

    Pronab

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

    [ed. note: pronab.saha last edited this post 13 years, 2 months ago.]
      • 21078
      • 77 Posts
      Hi Pronab!

      Multiple forms with FormIt should work. Make sure your two forms and their fields come along with unique ids.
        L.net Web Solutions
        Professional webdesign and development with MODX and WordPress.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Use the &submitVar property to differentiate between the forms.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 42503
          • 120 Posts
          Can you help me with some exampleQuote from: sottwell at Jul 22, 2013, 05:57 AM
          Use the &submitVar property to differentiate between the forms.
            • 42503
            • 120 Posts
            hi Chris,
            I have used all unique ids but still when I submit the other form get trigger. Quote from: sottwell at Jul 22, 2013, 05:57 AM
            Use the &submitVar property to differentiate between the forms.

            Quote from: Nebulous at Jul 22, 2013, 05:47 AM
            Hi Pronab!

            Multiple forms with FormIt should work. Make sure your two forms and their fields come along with unique ids.
              • 4172
              • 5,888 Posts
              what are your formit-calls and what's your form-markup now?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 21078
                • 77 Posts
                From the docs:
                If you have multiple forms on a page, set the &submitVar property on your Snippet call to a name of a form element within the form (ie, &submitVar=`form1-submit`). This tells FormIt to only process form requests with that POST variable.

                So I guess this should work:
                <!-- your snippet calls -->
                [[FormIt? ... &submitVar=`myform1`]]
                [[FormIt? ... &submitVar=`myform2`]]
                
                <!-- html myform1 -->
                <form ...>
                   ...
                   <input type="submit" value="send it" name="myform1">
                </form>
                
                <!-- html myform2 -->
                <form ...>
                   ...
                   <input type="submit" value="send it" name="myform2">
                </form>
                  L.net Web Solutions
                  Professional webdesign and development with MODX and WordPress.
                  • 42503
                  • 120 Posts
                  Hi
                  I got this information in one thread

                  https://forums.modx.com/thread/47592/submitvar-causing-formit-not-to-work-solved

                  I have applied the fix and now it is working fine.

                  Quote from: Bruno17 at Jul 22, 2013, 06:14 AM
                  what are your formit-calls and what's your form-markup now?
                    • 42503
                    • 120 Posts
                    Thanks all of you for your help.

                    Now I have another question. In my form I have four option like windows, linux, macos and novatel. Based on this option the user will get a auto response email. I mean for windows one type of auto response email, for linux another type of auto response email. So how I can do that. I have came cross the FormItAutoResponder hook but not able to work.

                    Please help.

                    Thank you

                    Pronab
                      • 4172
                      • 5,888 Posts
                      install getReqParam or something like that

                      name your fiarTpls fiarTplwindows,fiarTpllinux .........
                      and try it with this formit-property, if your radio-input-name is os:

                      &fiarTpl = `fiarTpl[[!getReqparam? &type=`REQUEST` &name=`os`]]`
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!