<?php
session_start();
$_SESSION['EventTitle'] = trim($_POST['EventTitle']);
$modx->setPlaceholder('EventTitle', $_SESSION['EventTitle']);
?>I think MODx is retrieving the chunk before the snippet executes. Can you use the code above in the second snippet instead? That should put things in the correct order.
Yes, you’re right. The second doc should have [!formSave!] at the beginning and then possibly the formRetrieve code within the same snippet, however the snippet doesn’t work in the chunk as I can see "[!formSession!]" (the new snippet) displaying at the top of the content area!
If I simply put [+EventTitle+] in the confirmation_page_chunk somewhere no value displays.
[!formSession!]
<?php session_start(); $_SESSION['EventTitle'] = trim($_POST['EventTitle']); $modx->setPlaceholder('EventTitle', $_SESSION['EventTitle']); $output = $modx->getChunk('chunk_name'); return ($output); ?>
[!FormProcessor? &form_chunk=`submitCalendar` &data_email_address=`[email protected]` &form_required=`Name,Description,Address,PhoneArea,Phone,Email,EventTitle,DateBegins,CompanyName,Address,CityStatePostcode` &data_email_subject=`Calendar Listing Request` &confirmation_page_chunk=`submitCalendarConfirmation`!]
[!formSession!] <p class="introtext"> Thanks for submitting your event listing for [+EventTitle+]. </p> <p>Please proceed to PayPal to make your payment. Event listings will only be posted once payment is confirmed.</p> <br /> <form method="post" action="https://www.paypal.com/cgi-bin/webscr"> <fieldset> <legend>Payment</legend> <p>All payment transactions are carried out securely via PayPal using Mastercard and Visa.</p> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="add" value="1"> <input type="hidden" name="business" value="[email protected]"> <input type="hidden" name="item_name" value="[+EventTitle+] - Event Listing"> <input type="hidden" name="item_number" value="LIST"> <input type="hidden" name="amount" value="79.00"> <input type="hidden" name="currency_code" value="AUD"> <input type="hidden" name="return" value="http://www.mydomain.com.au/thank-you"> <input type="hidden" name="undefined_quantity" value="1"> <button type="submit" name="submit" class="cart" value="Submit">Proceed to payment</button> </fieldset> </form>
<?php
session_start();
$_SESSION['EventTitle'] = trim($_POST['EventTitle']);
$modx->setPlaceholder('EventTitle', $_SESSION['EventTitle']);
$output = $modx->getChunk('chunk_name');
return ($output);
?><p class="introtext"> Thanks for submitting your event listing for [+EventTitle+]. </p> <p>Please proceed to PayPal to make your payment. Event listings will only be posted once payment is confirmed.</p> <br /> <form method="post" action="https://www.paypal.com/cgi-bin/webscr"> <fieldset> <legend>Payment</legend> <p>All payment transactions are carried out securely via PayPal using Mastercard and Visa.</p> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="add" value="1"> <input type="hidden" name="business" value="[email protected]"> <input type="hidden" name="item_name" value="[+EventTitle+] - Event Listing"> <input type="hidden" name="item_number" value="LIST"> <input type="hidden" name="amount" value="79.00"> <input type="hidden" name="currency_code" value="AUD"> <input type="hidden" name="return" value="http://www.mydomain.com.au/thank-you"> <input type="hidden" name="undefined_quantity" value="1"> <button type="submit" name="submit" class="cart" value="Submit">Proceed to payment</button> </fieldset> </form>
if($confirmation) {
// Return the confirmation chunk
$html = '{{'.$confirmation.'}}';
} else {if($confirmation) {
// set my placeholders
$modx->setPlaceholder('EventTitle', trim($_POST['EventTitle'] ));
// Return the confirmation chunk
$html = '{{'.$confirmation.'}}';
} else {