• Resolved garagesteve1155

    (@garagesteve1155)


    Trying to auto fill the inviter field on my registration form from url like this:

    Powertrader.net/register?invite=testuser

    But it just loads the page without the invite field filled in. What do I need to do instead so I can autofill fields from url?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support mansurahamed

    (@mansurahamed)

    Hi @garagesteve1155,

    You can use following jQuery code to populate a text field from url ( Where sometextfiled-5 is the input field ID, you can use browser inspection tool to find your invite field id)

    jQuery(document).ready(function(){
    
    var params = getUrlVars();
    
    jQuery('input#sometextfiled-5').val(params['invite']);
    
    });
    
    function getUrlVars()
    {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
    hash = hashes[i].split('=');
    vars.push(hash[0]);
    vars[hash[0]] = hash[1];
    }
    return vars;
    }

    Thanks.

    Thread Starter garagesteve1155

    (@garagesteve1155)

    Thanks! Where do I put this code on wordpress?

    Plugin Support mansurahamed

    (@mansurahamed)

    Hi @garagesteve1155,

    You can use a plugin like this https://wordpress.org/plugins/page-specific-scripts/ to add this code in your register page. There might be other similar plugins available which lets you add js code in specific page. Go to Pages->Registration->Edit, inside dashboard & add the code there.

    Thanks.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @garagesteve1155,
    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

    Thread Starter garagesteve1155

    (@garagesteve1155)

    Thanks I will give this a try!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @garagesteve1155

    You can also try this tutorial to populate the Registration fields from URL.

    Regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Auto fill field from url?’ is closed to new replies.