We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36786 ☆ A M B ☆
    • 209 Posts
    Ok so I'm trying to create a button/form that will enter information into a database table when clicked, using formit2db, and then redirect a user to another document (a dynamic CSV file created with rowBoat). However, I need three on a single page. When I try to use &submitVar, no data is entered into the database table and the user is not redirected to the CSV file, but stays on the same page. Without &submitVar, it works perfectly.

    I have used formit2db many times but this is the first time I have used &submitVar. Can anyone clairify what may be wrong? I must be doing something wrong, thanks!

    [[!FormIt? &hooks=`formit2db,redirect` &prefix=`modx_` &packageName=`packagename` &tablename=`tablename` &submitVar=`formname` &redirectTo=`265`]]
    
    <form action="[[~[[*id]]]]" method="post" name="formname" id="formname">
    
    <input type="hidden" name="username" value="[[+modx.user.id]]" />
    
    <input type="hidden" name="database" value="AccessLog" />
    
    <input type="submit" class="button" value="Access Log" />
    
    </form>

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

      Ben Morrison
      Hacking templates to pieces since 2003
    • discuss.answer
      • 28215
      • 4,149 Posts
      <input type="submit" class="button" value="Access Log" />


      needs to be:

      <input type="submit" name="formname" class="button" value="Access Log" />


      And you don't need the "name" attribute on your form.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 36786 ☆ A M B ☆
        • 209 Posts
        Ohhh, I saw an example i googled that was a bit unclear about it. Thanks!
          Ben Morrison
          Hacking templates to pieces since 2003