• Resolved Ssd Server 9 Inc ?

    (@ssdserver9)


    Hi,

    I’m using the below code to get a specfic output where it autofills the input fields “text-3” and “currency-1” according to the valuues of the input “date-1” “date-2” and “radio-1”, but the code doesn’t seem to working, please do resolve me the issue ASAP…

    window.addEventListener("DOMContentLoaded", (e) => {
        const t = document.querySelector("#forminator-field-currency-1"),
            a = document.querySelector('input[name="date-1"]'),
            n = document.querySelector('input[name="date-2"]'),
            r = document.querySelectorAll('input[name="radio-1"]'),
            o = document.querySelector("#forminator-field-text-3"),
            u = document.querySelector('input[name="name-1"]'),
            d = document.querySelector('input[name="name-2"]'),
            c = document.querySelector("#forminator-field-email-1"),
            l = document.querySelector("#forminator-field-text-1"),
            m = document.querySelector("#forminator-field-textarea-1"),
            s = document.querySelector("#forminator-field-phone-1"),
            v = document.querySelector("#forminator-field-number-1"),
            y = document.querySelector("#forminator-field-number-2"),
            f = document.querySelector("#payhere-payment");
        var h;
        const p = () => {
            let e = "Car",
                m = "0.00";
            if ("" != a.value && "" != n.value) {
                for (i = 0; i < r.length; i++) r[i].checked && (e = r[i].value);
                const t = new Date(a.value),
                    u = new Date(n.value);
                u.setDate(u.getDate());
                const d = u.getTime() - t.getTime(),
                    c = d / 864e5 > 0 ? d / 864e5 : 1;
                (o.value = 0 == c ? 1 : c), "Car" == e ? (m = 45 * c) : "Van" == e ? (m = 55 * c) : "Bus" == e ? (m = 70 * c);
            }
            t.value = m;
            var p = { start_date: a.value, end_date: n.value, days_diff: o.value },
                g = { name: u.value + " " + d.value, adult: v.value, child: y.value, phone: s.value, vehicle: e };
            (h = {
                sandbox: !1,
                merchant_id: "217544",
                return_url: void 0,
                cancel_url: void 0,
                notify_url: "https://payment.srilankatoursandcars.com/api.php",
                order_id: "01",
                items: "Customize Multi Tour",
                amount: m,
                currency: "USD",
                first_name: u.value,
                last_name: d.value,
                email: c.value,
                phone: s.value,
                address: void 0,
                city: l.value,
                country: l.value,
                custom_1: JSON.stringify(p),
                custom_2: JSON.stringify(g),
            }),
                "" != u.value && "" != d.value && "" != c.value && "" != l.value && "" != s.value && "" != v.value && "" != y.value && "" != a.value && "" != n.value ? (f.disabled = !1) : (f.disabled = !0);
        };
        t && (t.readOnly = !0),
            o && (o.readOnly = !0),
            f && (f.disabled = !0),
            a &&
                a.addEventListener("change", (e) => {
                    p();
                }),
            n &&
                a.addEventListener("change", (e) => {
                    p();
                }),
            m &&
                m.addEventListener("change", (e) => {
                    p();
                }),
            u &&
                u.addEventListener("change", (e) => {
                    p();
                }),
            d &&
                d.addEventListener("change", (e) => {
                    p();
                }),
            c &&
                c.addEventListener("change", (e) => {
                    p();
                }),
            l &&
                l.addEventListener("change", (e) => {
                    p();
                }),
            s &&
                s.addEventListener("change", (e) => {
                    p();
                }),
            v &&
                v.addEventListener("change", (e) => {
                    p();
                }),
            y &&
                y.addEventListener("change", (e) => {
                    p();
                }),
            r &&
                r.forEach((e) => {
                    e.addEventListener("change", (e) => {
                        p();
                    });
                }),
            (payhere.onCompleted = function (e) {
                document.querySelector(".forminator-button-submit").click(), alert("Payment completed");
            }),
            (payhere.onDismissed = function () {
                alert("Payment dismissed");
            }),
            (payhere.onError = function (e) {
                alert("Error:" + e);
            }),
            (document.getElementById("payhere-payment").onclick = function (e) {
                payhere.startPayment(h);
            }),
            (contactpayment = {
                sandbox: !1,
                merchant_id: "217544",
                return_url: void 0,
                cancel_url: void 0,
                notify_url: "https://payment.srilankatoursandcars.com/api.php",
                order_id: "01",
                items: "Customize Multi Tour",
                amount: 10,
                currency: "USD",
                first_name: "Website",
                last_name: "contact",
                email: "info@akasa.lk",
                phone: "0778786733",
                address: void 0,
                city: "srilanka",
                country: "srilanka",
            }),
            (document.getElementById("concheckout").onclick = function (e) {
                payhere.startPayment(contactpayment);
    ????????});
    });

    Thank you,
    Regards,
    Ssd Server 9

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @ssdserver9

    I hope you’re well today!

    Please check this two things:

    1. in form’s “Behavior” settings check current setting of “Rendering” option and try reverting it (if Load form using AJAX is enabled try disabling it; if it’s disabled, try enabling it).

    2. do test if it also fails if you disable all the plugins except Forminator and switch site (temporarily) to Twenty Twenty-Two or Twenty Twenty-Three theme.

    If it doesn’t change anything, please share the form in question with us so we could test it. To share form:

    – go to “Forminator -> Forms” page in your site’s back-end and click on a little “gear” icon
    – select “Export” option form the drop-down menu
    – put the exported code at pastebin.com and share direct link to it in response below.

    We’ll take a closer look into it then.

    Note please: this is a custom code; we will check it and try to help but be aware that we may not always be able to support such cases – custom code/solutions are out of scope of this support.

    Kind regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @ssdserver9 ,

    We haven’t heard from you for a week now, so it looks like you don’t need our assistance anymore.
    Feel free to re-open this ticket if needed.
    Kind regards
    Kasia

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JS Not working’ is closed to new replies.