-
- 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.
-
- 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.
-
- 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!
-
- 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');
-
- 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`]]