We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19597
    • 44 Posts
    I have 2 forms on one page of my MODx Revo, I have put both of them in their own CHUNK. Each of these chunks includes the form, and the specific FormIt call with the &SubmitVar included as well as other validators, etc.



    However, for whatever reason, when I hit Submit on my second form, it processes it as though I were still using the first form, causing it to use the wrong Template chunk, and email the wrong Email subject, etc. When I remove the first form / FormIt Call, the second form uses the proper Redirect page, Subject, and Template chunk (as specified in its FormIt call). If however I re-add the first form, it continues to break again.

    Below is the code for the 2 specific Form Chunks, does anyone see something wrong in this that I am missing? Cuz I’m at a loss :/

    First Chunk: Request-a-Quote-Form:
    [[!FormIt?
    &hooks=`spam,email,redirect`
    &emailTpl=`QuoteEmailChunk`
    &emailTo=`[email protected]`
    &emailSubject=`Request a Quote`
    &SubmitVar=`quotesubmit`
    &redirectTo=`16`
    &validate=`name:required,
    email:required,
    phone:required,
    text:required:stripTags,
    nospam:blank`
    ]]
    
    [[!+fi.error.error_message:notempty=`<p>[[!+fi.error.error_message]]</p>`]]  
       
    <form action="[[~[[*id]]]]" method="post" name="quotesubmit" class="form">  
        <input type="hidden" name="nospam" value="" />  
    
    <div style="display:block;">  
        <label for="name">  
            Name:  
            <span class="error">[[+fi.error.name]]</span>  
        </label>  
        <input type="text" name="name" id="name" value="[[+fi.name]]" size="30" />  
    </div>
    
    <div style="display:block;">    
        <label for="email">  
            Email:  
            <span class="error">[[+fi.error.email]]</span>  
        </label>  
        <input type="text" name="email" id="email" value="[[+fi.email]]" size="30" />  
    </div>
    
    <div style="display:block;">     
        <label for="phone">  
            Phone:  
            <span class="error">[[+fi.error.subject]]</span>  
        </label>  
        <input type="text" name="phone" id="phone" value="[[+fi.phone]]" size="30" />  
    </div>
      
    <div style="display:block;">  
        <label for="text">  
            Message:  
            <span class="error">[[+fi.error.text]]</span>  
        </label>  
    </div>
        <textarea name="text" id="text" rows="6" cols="30" value="[[+fi.text]]">[[+fi.text]]</textarea>  
      
        <br class="clear" />  
      
        <div class="form-buttons">  
            <input type="submit" name="quotesubmit" value="Submit" />  
        </div>  
    </form>


    Second Chunk: Newsletter Form:
    [[!FormIt?
    &hooks=`email,redirect`
    &emailTpl=`NewsletterEmailChunk`
    &emailTo=`[email protected]`
    &emailSubject=`Newsletter Sign-Up`
    &SubmitVar=`newslettersubmit`
    &redirectTo=`18`
    ]]
    
    [[!+fi.error.error_message:notempty=`<p>[[!+fi.error.error_message]]</p>`]]  
       
    <form action="[[~[[*id]]]]" method="post" name="newslettersubmit" class="form" style="position:relative;top:12px;left:35px;">  
    
    <div style="display:block;">    
        <label for="newsletter">  
            Email:  
            <span class="error">[[+fi.error.email]]</span>  
        </label>  
        <input type="text" name="newsletter" id="newsletter" value="[[+fi.newsletter]]" size="30" />  
            <input type="submit" name="newslettersubmit" value="Join" /> 
    </div>
    
    </form>



    Anyone have any thoughts?
      • 19597
      • 44 Posts
      I’m having an issue with what should be the most simple part of the FormIt process, actually using it.


      I have 2 forms on one page, and each of those forms has its own independent FormIt call included in the form CHUNK. Both of these FormIt calls have individual &SubmitVar=` ` values, to allow FormIt to determine which one is which and how to submit it.


      Needless to say, I don’t think SubmitVar works, at all. If I have 2 FormIt calls on my page, the second form still uses the same emailTpl, redirect page, and subject line as Form 1. Form 1 continues to work fine.

      I’ve just spent the last 2 hours (or more) trying literally everything that I could think of to get this to work properly, but all I am left with is frustration and I am forced to remove one of the forms from my page until it works as intended.
      I’ve received no suggestion as to what might be causing this, what I am doing wrong (if anything) or how to get it to work as intended. Assistance is appreciated.

      Original post here: http://modxcms.com/forums/index.php/topic,59894.0.html
        • 33337
        • 3,975 Posts
        I believe its &submitVar, and not &SubmitVar.
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 19597
          • 44 Posts
          Quote from: zi at Jan 17, 2011, 01:12 PM

          I believe its &submitVar, and not &SubmitVar.

          Omg you are a life saver and I am an idiot. I can’t believe that one capitalized letter was the difference between my forms working and being broken for 5 hours -_-. Gah.


          Thank you so much
            • 33337
            • 3,975 Posts
            No problem Minaris! wink
              Zaigham R - MODX Professional | Skype | Email | Twitter

              Digging the interwebs for #MODX gems and bringing it to you. modx.link