Amp Script

Prepopulate desired fields using AMPscript

Pinterest LinkedIn Tumblr

In this article, We will try to explore different business use cases to prepopulate a form with existing data of the customer rather than asking the customer to enter the data.

Business Use case: Some of the eCommerce websites pre-populates your email address when you click on unsubscribe. Some of the Telecom companies populate your Landing pages with prepopulated information such as Name, Phone number, and Email.

For this Demo, we have created a Sample form with Name, Email, Phone, Address, and Zip. If you observe closely we have used HTML tags starting with the Form Tag. If you save this code in a cloud page you will observe that a form is created with Name/Email/Phone/Address/Zip fields with a submit button. Customers/Prospects can submit the desired information from this page.

<label>Name:</label> <input name=”name” type=”text” />  

 <label>Email:</label> <input name=”email” type=”text” />  

 <label>Phone:</label> <input name=”phone” type=”number” />  

 <label>Address:</label> <input name=”address” type=”text” />  

 <label>Zip:</label> <input name=”zip” type=”number” />  

 <input name=”submit” type=”submit” value=”Submit” />

Let us try to pre-populate the form by using %%fieldname%% in the value of the input tag. If you save this code on a cloud page you will observe that a form is created with Name/Email/Phone/Address/Zip fields and you will also see values populated with %%Name%%,%%email%%, %%Address%%.

<label>Name:</label> <input name=”name” type=”text” value=”%%Name%%” />  

 <label>Email:</label> <input name=”email” type=”text” value=”%%email%%” />  

 <label>Phone:</label> <input name=”phone” type=”number” value=”%%phone%%” />  

 <label>Address:</label> <input name=”address” type=”text” value=”%%Address%%” />  

 <label>Zip:</label> <input name=”zip” type=”number” value=”%%ZipCode%%” />  

 <input name=”submit” type=”submit” value=”Submit” /> 

When you click on a cloud page link you should see something similar in your browser. If you want to test this in action then send a test email from Data extension and click on the button link on the email which takes you to this cloud page which prepopulates the desired data.

Note: Sometimes it may not be a good idea to use pre-population of data especially in a Forward to Friend Scenarios as it will expose the data of the customer to his/her friend.

Write A Comment