1

I'm trying to get variables on a microsite to pass from the form page to the thank you page. Passing the variables works, and loading them into a data extension, but getting them to also display passes null for the values. I've tried this using both the SSJS Write and stringify functions, and also passing them to ampscript variables, and neither works, but my DE is populated correctly. Code before the HTML open tag

%%[
VAR @Month, @Day, @month, @day
]%%
<script runat="server" language="javascript">
 Platform.Load("Core","1.1.1");
var monthChange = {
"May":"5",
"June":"6",
"July":"7",
"August":"8",
"September":"9",
"October":"10"
}
var submitterEmail = Request.GetFormField('email');
var submitterFirst = Request.GetFormField('name');
var submitterLast = Request.GetFormField('lastname');
var submitterMonth = Request.GetFormField('month');
  var adjustedMonth = monthChange[submitterMonth];
var submitterDay = Request.GetFormField('day');
var submitterDate = adjustedMonth + '/' + submitterDay + '/2018';
var sendDate = new Date(submitterDate);
Variable.SetValue("@Month",Stringify(submitterMonth));
  Variable.SetValue("@Day",Stringify(submitterDay));
if (IsEmailAddress(submitterEmail)) {
 var requestsDE = DataExtension.Init("dataextension");
 requestsDE.Rows.Add({
      FirstName: submitterFirst,
      LastName: submitterLast,
      EmailAddress: submitterEmail,
           ReminderDate: sendDate
      });
}
</script>
%%[
SET @month = @Month
SET @day = @Day
]%%
-!DOCTYPE html>
-html class="desktop" lang="en">
-head class="at-element-marker">
...

and then in the page

Got it! We’ll send you a reminder on %%=v(@month)=%%, %%=v(@day)=%%.

I can't figure out what I'm doing wrong.

  • 1
    Hi Erik! I just wanted to let you know that the expected path for importing code is to prefix each line with four spaces or a tab, or by wrapping the code in the tilde ("`") character, or by using the format code button ("{}" in the editor). The typical HTML <code> doesn't render quite as well here. I've gone ahead and fixed this one for you. – sfdcfox May 3 '18 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.