如何将表单字段推送到捐款表单上?

时间:2018-01-08 05:00:37

标签: javascript html forms bootstrap-4 donations

我已经被困了一段时间。尝试快速捐款小部件将捐款金额推送到“其他金额”字段中下一页的捐款表格上。

该表格嵌入网站并由Blackbaud Online Express托管,并且针对固定礼品金额执行/?BBGiftAmount = online等操作。但不适用于自定义金额。

以下是表单的HTML标记。

<div class="donation-wrapper">

<div class="container ">
    <div class="row d-flex align-items-center">

        <div class="col-lg-2 title">

            <h2>Make a Gift:</h2>
            <p>Give Generously</p>

        </div>
        <div class="col-lg-10">


            <form action="https://islamic-relief.com.au/what-we-do/aid-and-development/#become-volunteers" class="form-inline ">



                <label class="sr-only">Donation Type</label>
                <select class="form-control my-1 mr-sm-2">
                    <option selected>One Time Donation</option>
                    <option value="1">Recurring Donation</option>
                </select>

                <label class="sr-only">Donation Amount</label>
                <input value="" class="form-control my-1 mr-sm-2" type="number" placeholder="Donation Amount">

                <label class="sr-only">Choose Fund</label>
                <select name="BBFund" id="bboxdonation_designation_ddDesignations" class="form-control my-1 mr-sm-2">
                    <option value="103">Lebanon Disability Centre</option>
                    <option value="84">Water and Sanitation</option>
                </select>

                <button type="submit" class="btn btn-primary my-1">Donate Now</button>


            </form>


        </div>

    </div>
</div>

</div>

此外,通过Chrome控制台找到托管表单正在读取“?BBGiftAmount =”的操作的位置。

function i(t) {
                    var p = location.search.replace("?", "").split("&"),
                        m = BBOX.buildQuerystringObject(p),
                        s, q, u = false,
                        o = false,
                        l = m.hasOwnProperty("bbhideothergifts") && m.bbhideothergifts === "1",
                        v = m.hasOwnProperty("bbhideotherfunds") && m.bbhideotherfunds === "1",
                        n = !t || l,
                        r = !t || v;
                    if (n && m.hasOwnProperty("bbgiftamount")) {
                        q = parseFloat(m.bbgiftamount);
                        f.each(a.find(".BBFormRadioGivingLevelItem .BBFormRadioGivingLevelOther"), function() {
                            if (parseFloat(f(this).val()) === q) {
                                a.find(".BBDFormSectionGiftInfo input[data-giftchoice][value='1']").attr("checked", "checked").change();
                                f(this).attr("checked", "checked").change();
                                u = true;
                                return false
                            }
                        })
                    }
                    if (n && m.hasOwnProperty("bbpledgeamount")) {
                        q = parseFloat(m.bbpledgeamount);
                        f.each(a.find(".BBFormRadioPledgeAmountItem .BBFormRadioGivingLevel"), function() {
                            if (parseFloat(f(this).val()) === q) {
                                a.find(".BBDFormSectionGiftInfo input[data-giftchoice][value='0']").attr("checked", "checked").change();
                                f(this).attr("checked", "checked").change();
                                o = true;
                                return false
                            }
                        })
                    }
                    if (l) {
                        if (u && o) {
                            a.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove();
                            a.find(".BBFormRadioPledgeAmountItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove()
                        } else {
                            if (u) {
                                a.find(".BBFormGiftChoice").remove();
                                a.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove()
                            } else {
                                if (o) {
                                    a.find(".BBFormGiftChoice").remove();
                                    a.find(".BBFormRadioPledgeAmountItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove()
                                }
                            }
                        }
                    }
                    if (r && m.hasOwnProperty("bbfund")) {
                        s = a.find('.BBDFormSectionDesignationInfo select[id*="ddDesignations"]');
                        if (s.find('option[value="' + m.bbfund + '"]').length > 0) {
                            s.val(m.bbfund);
                            if (v) {
                                s.find('option[value!="' + m.bbfund + '"]').remove()
                            }
                        }
                    }
                }

0 个答案:

没有答案