pardot form setup

How To Restrict A Date Calendar Field Value To Show Only Selected Dates In A Pardot Form

By admin November 4, 2019
Blog, Salesforce Development 0

Pardot is a smart marketing automation tool built on the world’s No1# CRM platform, i. e. Salesforce. Its implementation can boost business capabilities and ensure new dimensions to marketing automation.

In addition, Pardot form fields are used in forms and landing pages as they can deliver different data formats and can be linked to either default or custom fields. You can enter values in these fields to initiate automation rules and can also sync those values with your CRM system.

In this article we will explore customization options of a default Pardot form field called the “Date Field”. It’s a well-known fact that Pardot does not provide any functionality to show only selected date for input field whose type is ‘date’. Despite that shortcoming, we can achieve this with the help of date picker JS library script.

Following steps are needed to achieve this task:

1. Change the input type of the field from ‘date’ to ‘input’ as date picker will not work for ‘date’ type field.

2. Place following code in the layout section of the editor:
<script>
var availableDates = [“14-10-2019″,”15-10-2019″,”19-10-2019”];
function available(date) {
dmy = date.getDate() + “-” + (date.getMonth()+1) + “-” + date.getFullYear();
if ($.inArray(dmy, availableDates) != -1) {
return [true, “”,”Available”];
} else {
return [false,””,”unAvailable”];
}
}

$(‘.date-pick input’).datepicker({beforeShowDay:available});
</script>

date-pick is class name of <p> tag in which a date input field occurs.

});

You can clearly see how the use of JS Query has been done to add custom date selection logic in the code so that they can appear in the Pardot forms.

This feature can be used in enhancing business processes and delivering value to customers. Here is a snapshot of how the field will look like at the frontend.

MDG

Using the custom JS Query as shared above we can see how only the selected dates are now made available for end-users using the form.
This process can be used in e-commerce, ticket booking, event planning, age selections, banking, booking and other online businesses offering booking services.

Contact us today if you need help with a custom Pardot Form set-up.

Related Posts

Popular post