Viewing 1 replies (of 1 total)
  • Thread Starter lianix

    (@lianix)

    Resolved with two tips.

    First:
    I’ve put in footer.php

    <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script>
    var dataObj = {};
    var data = document.location.search.substr(1);
    
        $.each(data.split("&"), function () {
            var el = this.split("="),
                    elName = decodeURIComponent(el[0]),
                    elVal = el.length > 1 ? decodeURIComponent(el[1]) : null;
            if (!(elName in dataObj)) {
                dataObj[elName] = [];
            }
            dataObj[elName].push(elVal);
        });
        $(":input").each(function () {
            if (!($(this).attr("name") in dataObj)) {
                this.checked = false;
            }
        });
        $.each(dataObj, function (i, val) {
            $("[name='" + i + "']").val(val);
        });
    </script>

    http://www.site.com/form/?/?give-radio-donation-level=500.00 where “give-radio-donation-level” is the name of the input radio and “500.00” is the value of the radio.

    And in the functions.php (or the plugin used for add functions)

    with this: https://givewp.com/populate-donor-info-one-click/

    I can use in url the amount.

    In the end the complete url can be:

    http://www.site.com/form/?give-radio-donation-level=500.00&amount=500.00

    So the amount input is 500
    The checked donation level is the corrispondent of 500 created in settings.

Viewing 1 replies (of 1 total)
  • The topic ‘prepopulate donation level with url’ is closed to new replies.