We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30912
    • 463 Posts
    Would someone mind casting their eyes over this for me, because im clearly missing something.

    Modx 2.2.8pl and Formit 2.2.0.

    Two forms on a single contact page - side by side, almost the same fields but entirely different field names and submit vars.

    heres what is happening:

    Form 1 press submit with no data, validation kicks in reports ok. fill fields, form submits
    Form 2 press submit with no data, validation kicks in, reports errors on form 1. fill fields, form doesnt submit.

    I've done the exact same process before on another site with no issue but I've never seen Formit target a different form before.

    Form 1

    [[!FormIt?
       &hooks=`spam,email,redirect`
       &emailTpl=`AskAQuestionEmailTpl`
       &emailTo=`[email protected]`
    &submitVar=`questionsubmit`
       &validate=`
    name:required,
          email:email:required,
          question:required:stripTags,
    nospam:blank`
    &emailSubject=`Ask a Question Submission `
    &redirectTo=`19`
         
    ]]
    
    [[!+fi.error_message:notempty=`
    <p>[[!+fi.error_message]]</p>
    `]]
    <form action="[[~[[*id]]]]" method="post"  class="form" id="questionform">
      <input type="hidden" name="nospam:blank" value="" />
      <input type="text" class="ibox" name="name" id="askaquestion_name" placeholder="Name" value="[[!+fi.name]]" />
      <span class="error">[[!+fi.error.name]]</span>
      <input type="text" class="ibox" name="email" id="askaquestion_email" placeholder="Email" value="[[!+fi.email]]"/>
      <span class="error">[[!+fi.error.email]]</span>
      <textarea name="question" id="askaquestion_question" placeholder="Question" class="box">[[!+fi.question]]</textarea>
      <span class="error">[[!+fi.error.question]]</span>
      <input type="submit" name="questionsubmit" class="submitBtn" alt="Submit" />
    </form>


    Form 2:
    [
    ]
    [[!FormIt?
       &hooks=`spam,email,redirect`
       &emailTo=`[email protected]`
       &redirectTo=`19`
    	&emailSubject=`Software Test Submission`
    	&submitVar=`softwaresubmit`
          &validate=`
    sname:required,
          semail:email:required,
          snotes:required:stripTags,
    nospam1:blank`
    ]] 
    
    [[!+fi.error_message:notempty=`
    <p>[[!+fi.error_message]]</p>
    `]]
    <form action="[[~[[*id]]]]" method="post" class="form" id="softwareform">
      <input type="hidden" name="nospam1:blank" value="" />
      <input type="text" class="ibox" name="sname" id="softwarename" placeholder="Name" value="[[!+fi.sname]]"  />
      <span class="error">[[!+fi.error.sname]]</span>
      <input type="text" class="ibox" name="semail" id="softwareemail" placeholder="Email" value="[[!+fi.semail]]" />
      <span class="error">[[!+fi.error.semail]]</span>
      <textarea name="snotes" id="softwarenotes" class="box" placeholder="Send us an email and we will supply you with FTP access to supply your model,  or alternatively supply us a download location."></textarea>
      <span class="error">[[!+fi.error.snotes]]</span>
      <input type="submit" name="softwaresubmit"  class="submitBtn" alt="Submit" />
    </form>
    
     [
    ]

    I'm sure its something simple but for the life of me I cannot see it.

    many thanks
    [ed. note: Tyreal2012 last edited this post 10 years, 5 months ago.]
      • 30912
      • 463 Posts
      So, fresh eyes this morning, it seems that Formit doesnt like submit vars and multiple forms with iamegs as a submit, removing the images and using true submit buttons seems to work