Hello,
We're currently using Marketo with Unbounce landing pages. We need to combine last name, last 4 of the phone number, and the word 'Household' to populate the company field in Marketo, if possible.
Example Company field format in Marketo: Smith7890 Household
Is it possible to concatenate a full field (last name), capitalize the first letter and lowercase the rest, if needed, add the last 4 numbers of the phone, add a space, then add the word 'Household', all inside Marketo? Or is this something that needs to be done/can be done on the page via JS before sending the data to Marketo?
Sanford Whiteman, is this something you're familiar with?
Solved! Go to Solution.
<script>
document.forms[0].addEventListener("submit", function(e){
this.Company__c.value =
this.LastName.value.substr(0,1).toLocaleUpperCase() +
this.LastName.value.substr(1).toLocaleLowerCase() +
this.Phone.value.substr(-4) +
" Household";
});
</script>
Add this to Unbounce as a "Before Body End Tag" script.
Sure, it could be done within the Unbounce form. (Standard DOM input value for a hidden field in this case, as it's not a Marketo form.) Add the field to the form as hidden and post a link to your page.
Ty Sanford Whiteman! Are you saying to post a link to the page here in this thread? If so, would you mind if I messaged you the link directly?
Yeah, you can message me.
<script>
document.forms[0].addEventListener("submit", function(e){
this.Company__c.value =
this.LastName.value.substr(0,1).toLocaleUpperCase() +
this.LastName.value.substr(1).toLocaleLowerCase() +
this.Phone.value.substr(-4) +
" Household";
});
</script>
Add this to Unbounce as a "Before Body End Tag" script.
Thank you!!
Erik Hill
Amrock
Creative Technology Manager
office 313-877-2450
mobile 313-910-9458
erikhill@amrock.com
Hey Sanford,
I'm seeing the concatenated name in the activity log under form fields but the field isn't populating the value. Any thoughts?
I take that back.. it's showing! Thank you SO much again!!