Placeholders in landing pages
As mentioned in the previous chapter when the script sends the content of the landing page back to the browser, the content can be modified by the script to include field values and validation error messages. This feature works with the embed, message and HTML form method of the landing page, but not with redirect.
Placeholders are pieces of code that can be included in landing pages to be replaced either by field values of the HTML form or by validation messages, before the resulting embedded page is sent to the user's browser.
Placeholders are HTML comments. They can be included using any text program or editor, and do not affect the landing page programming or design. Placeholders must be included where you want the value or error message to be displayed.
Note: placeholders are case-sensitive, as well as sensitive to additional blank spaces. They must be written just as they are displayed in this user's guide.Display validation errors: <!--VALIDATIONERROR-->
When the placeholder
<!--VALIDATIONERROR-->
is included in the error landing page, it will be replaced by the error messages of any validation failing field upon sending the HTML form.
For example, if in the resulting error page the following placeholder is included:
<html>
<head>
<title>Error</title>
</head>
<body>
<p>One or more fields are incorrect:</p>
<p>
<!--VALIDATIONERROR-->
</p>
</body>
</html>
One the landing error page is sent to the user's browser, the placeholder is replaced by the different error messages of the validation-failing fields. For example:
<html>
<head>
<title>Error</title>
</head>
<body>
<p>One or more fields are incorrect:</p>
<p>
Invalid email address<br />
The city must contain at least 2 chars<br />
</p>
</body>
</html>
Displaying the field value
Another placeholder that can be used to display the specific field value in the landing page is:
<!--FIELDVALUE:fieldname-->
When you replace 'fieldname' for the field name of the form, the landing page will display the field value in the user’s browser. For example:
<html>
<head>
<title>Error</title>
</head>
<body>
<p>Thanks for contacting us <!--FIELDVALUE:firstname--></p>
<p>We'll send you an answer soon</p>
</p>
</body>
</html>
It will display the firstname field value in the user's browser:
<html>
<head>
<title>Error</title>
</head>
<body>
<p>Thanks for contacting us John</p>
<p>We'll send you an answer soon</p>
</p>
</body>
</html>
Displaying the validation error message
Also by replacing 'fieldname' for the field name in the following placeholder:
<!--ERRORMSG:fieldname-->
the field validation error message will be displayed in the user's browser. For example:
<html>
<head>
<title>Error</title>
</head>
<body>
<p>Please check the following errors</p>
<p><!--ERRORMSG:firstname--></p>
<p><!--ERRORMSG:lastname--></p>
<p><!--ERRORMSG:emailaddress--></p>
</body>
</html>
If the field failing validation is emailaddress, the error message associated to the validation will be displayed in the user's browser:
<html>
<head>
<title>Error</title>
</head>
<body>
<p>Please check the following errors</p>
<p>Email address format is incorrect</p>
</body>
</html>