1

I've created a subscription form in MC Cloud Pages in which users can sign up for a newsletter and can also fill in their first name, last name and date of birth. The date of birth field consists of three drop-down fields, one each for day, month, and year. When the form is submitted, the day, month and year are inserted into the Data Extension in Marketing Cloud as separate values. I want to merge these fields into one Date of Birth field.

Is is possible to create a dateOfBirth field in the data extension where the 3 values of day, month and year are merged into?

  • are you building this via HTML, or using the drag and drop WYSIWYG editor? – Gortonington Mar 7 '18 at 17:49
  • I've built this form in HTML, with some Javascript and AMPscript – Rutger Mar 8 '18 at 8:31
1

Yes. Here is how I have done it in the past:

1) Create a hidden field on the page. This is where you will hold the merged values.

2) Create a jquery (or javascript of your choice) to properly concat the 3 values on submit.

3) When the submit button is clicked the client side scripts will be executed before the POST and the hidden field would have your data.

|improve this answer|||||
1

If you want to steer away from Jquery or JS, and instead handle it via AMPscript, you can actually have the page post to itself and do an upsert to collect the info.

You would need to CONCAT the 3 values into a variable, then use that variable to post into the DE.

Example: (Replace Parameter values below with the names of your corresponding inputs)

%%[

SET @EmailAddress = RequestParameter("EmailAddress")
SET @FirstName = RequestParameter("FirstName")
SET @LastName = RequestParameter("LastName")
SET @Day = RequestParameter("Day")
SET @Month = RequestParameter("Month")
SET @Year = RequestParameter("Year")
SET @DOB = CONCAT(@Month, "/", @Day, "/", @Year)

IF NOT EMPTY(@EmailAddress) THEN
   UPSERTDE(@yourDE, 1, "EmailAddress", @EmailAddress, "FirstName", @FirstName, "LastName", @LastName, "DateOfBirth", @DOB)
ENDIF
]%%

This way you can also format the Date of Birth as a date via Format() or FormatDate()

|improve this answer|||||

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.