Support » Plugin: Contact Form 7 » pre fill form from other page with javascript

  • I would like form to have some elements pre filled with data already filled out on a previous page.
    I have tried adding this to the page

    <script text="text/javascript">
    var getUrlParameter = function getUrlParameter(sParam) {
        var sPageURL = decodeURIComponent(,
            sURLVariables = sPageURL.split('&'),
        for (i = 0; i < sURLVariables.length; i++) {
            sParameterName = sURLVariables[i].split('=');
            if (sParameterName[0] === sParam) {
                return sParameterName[1] === undefined ? true : sParameterName[1];
    var movetype = getUrlParameter('type');
    document.getElementsByClassName('Movingtype').value = movetype;
    console.log("testing5 "+movetype);

    and I get the log but the select box isn’t pre-filled

    I have also tried

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘pre fill form from other page with javascript’ is closed to new replies.