1

I am trying to display the row values in Dataextension based on the values submitted in the landing page form .Is there any way to display the retrieved value in HTML? And the code which i tried is

<!DOCTYPE HTML>
%%[ set @UrlThispg = RequestParameter('PAGEURL') ]%%
<script runat="server" type="text/javascript">
     Platform.Load("core", "1");
     if (Request.Method == "POST") 
     {

        var useremail = Request.GetFormField('useremail');
        Write("UserMail::<br/>"+useremail);
        var CDE = DataExtension.Init("Codelist");
        var filter = {Property:"codeno",SimpleOperator:"equals",Value:"78888"};
var totrowscount=CDE.Rows.Retrieve(filter);}
</script>
<html>
  <head>
  </head>
  <body>
     <form id="formName" action="%%=v(@urlThispg)=%%" method="post" enctype="application/x-www-form-urlencoded"> 
       <input type="text" name="useremail" placeholder="Your email address...">                             
       <input type="submit" value="submit">
     </form>
  </body>
</html>

And to desserialize the json and display the out put i have used the method defined in docmentation here ETDocument .But I am not sure whether I am using it in correct place.If I could get some help it will be great.Thanks in advance.

4
  • Looks correct to me. Do you see "Usermail::" when you view the page source in your browser? May 25, 2016 at 14:55
  • Hi Adam thanks for your response i was able to do this with "Lookup functionality" like CDE.Rows.Lookup(["EmailAddress"], [usermail]) .It worked and was simple . May 26, 2016 at 3:04
  • @AdamSpriggs if i need to call a function on button click will it work in landing pages ?I tried one but its throwing method not defined.Do i need to call any resource in script? May 26, 2016 at 9:57
  • Yes, if you understand the difference between client-side and server-side JavaScript. May 26, 2016 at 11:43

1 Answer 1

1

I could able to do this with lookup functionality in SSJS and it was simple.I have posted the code below which I have used and it can be also displayed in table.

<!DOCTYPE HTML>
%%[ set @UrlThispg = RequestParameter('PAGEURL') ]%%
<script runat="server" type="text/javascript">
    Platform.Load("core", "1");
    if (Request.Method == "POST") 
    {

        var useremail = Request.GetFormField('useremail');
        Write("UserMail::<br/>"+useremail);
        var CDE = DataExtension.Init("Codelist");
        var data = CDE.Rows.Lookup(["EmailAddress"], [useremail]);
        Write("Your code is  "+data[0].Codeno);

   }
</script>
<html>
  <head>
  </head>
  <body>
    <form id="formName" action="%%=v(@urlThispg)=%%" method="post" enctype="application/x-www-form-urlencoded"> 
       <input type="text" name="useremail" placeholder="Your email address...">                             
       <input type="submit" value="submit">
    </form>
  </body>
</html>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .