Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter anhrgrt

    (@anhrgrt)

    I solved the problem by myself. I have put the code directly in the file: /wp-content/uploads/form-maker-frontend/js/fm-script-1.js. Now it works perfectly.

    thanks

    Thread Starter anhrgrt

    (@anhrgrt)

    Hello,

    now i have an other question. I want to pre select two dropdown fields with an url. For example /?field1=test1&?field2=test2.

    Could someone help me with the javascript code?

    Plugin Support Zhanna Khachatryan

    (@zhannak)

    Dear @anhrgrt,

    Please add the below code in your Form / Form Options / Javascript Tab and it should work.

    function before_load() {
    function getParameterByName(name, url) {
    if (!url) {
        url = window.location.href;
    }
    name = name.replace(/[[]]/g, "$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
    results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace('/+/g', " "));
    }
    jQuery("#wdform_13_element13").val(getParameterByName("field1"));
    }

    Here #wdform_13_element13 is the field where the value should be added.

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

The topic ‘Pre select function in dropdown’ is closed to new replies.