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?

This topic contains 2 replies, has 2 voices, and was last updated by  Sean Copeland 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #12711

    Sean Copeland
    Participant

    Hi,

    I have a two-step sign-up process on studentawards.com where the user enters their email on the landing page and then clicks on a button which sends them to the full registration form. I would like to pass the email they entered into the registration form. I have already setup everything on the landing page to send the email address into the URL, but the registration form on the next page needs to grab the email from the url.

    I noticed that this is an option with WP Everest Forms and I’m wondering how to do it with the WP Everest User Registration plugin.

    Thanks,

    Sean.

    #12759

    sanjeev3
    Member

    Hi sean,

    Currently, there is no such option to populate the fields from the URL.

    Thank You!

    #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;
    });

    });

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.