Member Register - Copy "Custom Text 1" to External Identifier

Script to use when a client wants the Custom Text 1 value copied as the Member's External Identifier upon registration

Add Script on Registration Page

<script>
document.getElementById("aspnetForm").addEventListener("submit",setCustomText1CookietoExternal);

function setCustomText1CookietoExternal() {
setCookie("EX_RREF", document.getElementById("ctl00_ContentPlaceHolder1_txtCustomText1").value, 365)
}

function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
var expires = "expires=" + d.toGMTString();
var domain = "domain=" + window.location.hostname;
document.cookie =
cname + "=" + cvalue + ";" + domain + ";" + expires + ";path=/";
}

</script>

What it does:

  1. Adds the script to fire on button submit
  2. On button submit takes value of Custom Text 1 and sets in cookie "EX_RREF"
  3. Code behind page takes the cookie and copies to member external identifier
If you want to use custom text 2 instead. Replace "setCookie("EX_RREF", document.getElementById("ctl00_ContentPlaceHolder1_txtCustomText1").value, 365)" with "setCookie("EX_RREF", document.getElementById("ctl00_ContentPlaceHolder1_txtCustomText2").value, 365)"
Only works from registration page. If member updates their Custom Text via other ways... API, member page...admin... will not update external identifier.

How did we do?


Powered by HelpDocs

Powered by HelpDocs