3

I have two microsite cloud pages: (1) to ask a user for the information, and (2) one that takes the information and uses it in a SSJS WSProxy call

The first page captures information like:

<form id="myForm" method="post" action="xxxxxxxxxxxxx">
    <input type="text" name="deCustKey"/>Data Extension External Key<br />
    <input type="text" name="retrieveMid"/>Retrieve MID<br />
    <input type="text" name="createMid"/>Create MID<br />
    <input type="text" name="folderID"/>Target Folder<br />
    <input type="text" name="name"/>Name of New DE<br />
    <input type="text" name="description"/>Description of New DE<br />
    <input type="submit" />
</form>

The problem is that the second microsite page (referenced by the xxxxx above) does not seem to be capturing the variables from this first page.

I have tried using the following in the body tag (which is before my SSJS) and then

/* before SSJS */
<input id="deCustKey" type="hidden" value="%%=v(@deCustKey)=%%">
<input id="retrieveMid" type="hidden" value="%%=v(@retrieveMid)=%%">
<input id="createMid" type="hidden" value="%%=v(@createMid)=%%">
<input id="folderID" type="hidden" value="%%=v(@folderID)=%%">
<input id="name" type="hidden" value="%%=v(@name)=%%">
<input id="description" type="hidden" value="%%=v(@description)=%%">

/* within SSJS */
var deCustKey = Variable.GetValue('@deCustKey');
var retrieveMid = Variable.GetValue('@retrieveMid');
var createMid = Variable.GetValue('@createMid');
var folderID = Variable.GetValue('@folderID');
var name = Variable.GetValue('@name');
var description = Variable.GetValue('@description');

I have tried a couple others as well, but I am having difficulty passing these variables from client-side input on the first page into variable that I can access within my SSJS.

Thanks!


<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head> 
<body>

<script runat="server">

Platform.Load('Core', '1');

var deCustKey = Request.GetFormField('deCustKey');
var retrieveMid = Request.GetFormField('retrieveMid');
var createMid = Request.GetFormField('createMid');
var folderID = Request.GetFormField('folderID');
var name = Request.GetFormField('name');
var description = Request.GetFormField('description');

</script>

deCustKey is: <ctrl:var name=deCustKey/><br>
retrieveMid is: <ctrl:var name=retrieveMid />
createMid is: <ctrl:var name=createMid/><br>
folderID is: <ctrl:var name=folderID />
name is: <ctrl:var name=name/><br>
description is: <ctrl:var name=description />

</body>
</html>
3

On the second/processing page, you can use the GetFormField method to capture the form values submitted from the first page:

<script runat="server">
Platform.Load('Core', '1');

var deCustKey = Request.GetFormField('deCustKey');
var retrieveMid = Request.GetFormField('retrieveMid');
// etc...
</script>

And if you ever need to output these values elsewhere on the second page (e.g., body or within client-side JS):

<body>
deCustKey is: <ctrl:var name=deCustKey /><br>
retrieveMid is: <ctrl:var name=retrieveMid />
</body>
9
  • Thank you for the tips - I tried simplifying both pages to test it and display the values being passed, but it still does not appear to be pulling the variables from the first page. After submitting the data on the first page, it does not redirect as it normally does. It just clears the values from the page. I will update the above question to show the first and second page. – Lyle Mar 26 '19 at 0:14
  • The above question was updated to contain your recommendations. Have you encountered this issue before where the values clear and you do not get directed to the second page? – Lyle Mar 26 '19 at 0:23
  • @Lyle are you using any client-side JS that interacts with the form inputs on the first page? – Mark G Mar 26 '19 at 0:26
  • I am not using any client side JS at this time. After filling out the first form, I am trying to pass those variables into the server side JS that I have recently added above. Is that not possible? I need those variables because my end goal is taking the inputs (which are details of a target DE) and then user a SSJS that retrieves the structural details of the DE and then creates a copy of it in the target business unit. – Lyle Mar 26 '19 at 0:44
  • @Lyle that is definitely possible (I copied and pasted your updated code and it works fine on my end). Have both of the pages been republished? Have you tried loading each of the two pages individually in separate browser tabs to see if any errors are encountered? Have you double-checked that the URL in the action parameter is correct? – Mark G Mar 26 '19 at 0:47

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.