Reply To: How can I pre-populate user registration form input fields from url parameters?

Home Forums User Registration How can I pre-populate user registration form input fields from url parameters? Reply To: How can I pre-populate user registration form input fields from url parameters?

#13267

Sean Copeland
Participant

Hmmm … would the following javascript in the footer work though?

`
function getParam(user_email) { name = name.replace(/[\[]/, “\\[“).replace(/[\]]/, “\\]”); var regex = new RegExp(“[\\?&]” + name + “=([^&#]*)”), results = regex.exec(location.search); return results === null ? “” : decodeURIComponent(results[1].replace(/\+/g, ” “)); }
Webflow.push(function() {

// Auto-populate form fields (text fields only) based on query string
$(‘input:text, input[type=email]’).each(function() {
var paramValue = getParam(this.id);
if(this.value == “” && paramValue != “”) this.value = paramValue;
});

});