We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36582
    • 463 Posts
    Say I have 12 modx resources that each represent a presentation at a seminar. I'm thinking of using something like GetField to populate a form with a Tpl that will display the title of the presentation and also add an input field. The idea is that a visitor could indicate how many places they require at each seminar. No calculations required.

    Would this work and how would I pass this through to the email chunk?

    Thanks in advance.
      Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
    • Yes I think it would work with FormIt: https://rtfm.modx.com/extras/revo/formit. You would be setting the value of the form element to your predefined method/GetField. Then in your email tpl just set the placeholder as a name like you normally would.
        • 8168
        • 1,118 Posts
        Or use wayfinder or getresources and make sure in the TPL you have a name , id and value field for each form element and all should work fine.
          • 44165
          • 20 Posts
          Any luck? I am trying to achieve something similar, but am struggling. I would like to have input fields in a getresources template, then pass them to the formit form. Basically for an order form. Each product resource has a quantity input, populate the form with getresources, user inputs quantity desired for each product, pass that along in formit email. Has me stumped!
            • 3749
            • 24,544 Posts
            You can put something like this in your innermost Tpl chunk:

            <span>Product: </span>[[+pagetitle]]"  <span>Quantity:</span> <input name="[[+pagetitle]]-quantity" type="text" />


            That way, the $_POST array from the submission will have the values. For example, if the pagetitle is "shoes," the number of shoes ordered will be in $_POST['shoes-quantity']. That will be available in a FormIt hook like this:

            $shoesOrdered = $hook->getValue('shoes-quantity');


              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
              • 36582
              • 463 Posts
              I'm not sure if the following will be appropriate for you but this is what I did...

              The following picks up my page title and passes it to a formit chunk...

              <a class="button hollow text-center" href="[[~124]]?item=[[*pagetitle:urlencode]]" >Ask us about [[*pagetitle]]</a>


              And the setPlaceholders snippet call is in the top of the formit chunk

              [[!setPlaceholders? &ph=`title == request.item`]]

                Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk