{"id":105,"date":"2026-10-01T05:52:36","date_gmt":"2026-10-01T05:52:36","guid":{"rendered":"https:\/\/www.evergreenenergyclub.com\/membership\/?page_id=105"},"modified":"2026-10-01T09:27:20","modified_gmt":"2026-10-01T09:27:20","slug":"tariff-search-form","status":"publish","type":"page","link":"https:\/\/www.evergreenenergyclub.com\/membership\/tariff-search-form\/","title":{"rendered":"Tariff Search Form"},"content":{"rendered":"        <section id=\"eec-switch-access-1\" class=\"eec-switch-access\">\n            <form class=\"eec-switch-access__form\" method=\"post\" action=\"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/eec\/v1\/switch-access\">\n                <label for=\"eec-switch-access-1-postcode\">Home postcode<\/label>\n                <input id=\"eec-switch-access-1-postcode\" name=\"home_postcode\" type=\"text\" maxlength=\"30\" autocomplete=\"postal-code\" placeholder=\"e.g. SW1A 1AA\">\n                <label for=\"eec-switch-access-1-member\">Member ID<\/label>\n                <input id=\"eec-switch-access-1-member\" name=\"member_reference\" type=\"text\" maxlength=\"8\" required placeholder=\"e.g. EEC-1232\" autocomplete=\"off\" pattern=\"[Ee][Ee][Cc]-[1-9][0-9]{3}\">\n                <button type=\"submit\" class=\"eec-switch-access__submit\">Submit<\/button>\n                <p class=\"eec-switch-access__status\" role=\"status\" aria-live=\"polite\"><\/p>\n                <noscript>Please enable JavaScript to check your membership and continue.<\/noscript>\n            <\/form>\n            <dialog class=\"eec-switch-access__dialog\" aria-labelledby=\"eec-switch-access-1-title\" aria-describedby=\"eec-switch-access-1-message\">\n                <button type=\"button\" class=\"eec-switch-access__close\" aria-label=\"Close popup\">&times;<\/button>\n                <h3 id=\"eec-switch-access-1-title\">Membership access<\/h3>\n                <p id=\"eec-switch-access-1-message\" class=\"eec-switch-access__message\"><\/p>\n                <a class=\"eec-switch-access__join\" href=\"https:\/\/www.evergreenenergyclub.com\/join.html\" target=\"_top\" hidden>Join Now<\/a>\n            <\/dialog>\n        <\/section>\n        <style>\n        .eec-switch-access {max-width:480px;margin:24px auto;color:#183b35;font-family:inherit}\n        .eec-switch-access__form {display:grid;gap:12px;padding:24px;background:#f5f8f4;border:1px solid #dce6db;border-radius:16px}\n        .eec-switch-access__form label {font-weight:600}\n        .eec-switch-access__form input:not([type=\"hidden\"]) {box-sizing:border-box;width:100%;padding:13px 14px;border:1px solid #9cad9f;border-radius:8px;background:#fff;color:#183b35;font:inherit}\n        .eec-switch-access__form input:focus-visible,.eec-switch-access button:focus-visible,.eec-switch-access a:focus-visible {outline:3px solid #477760;outline-offset:3px}\n        .eec-switch-access__submit,.eec-switch-access__join {border:0;border-radius:8px;background:#c8f58a;color:#183b35;padding:13px 22px;font:inherit;font-weight:700;cursor:pointer;text-align:center;text-decoration:none}\n        .eec-switch-access__submit:disabled {opacity:.6;cursor:wait}\n        .eec-switch-access__status {margin:0;font-size:14px}\n        .eec-switch-access__dialog {position:fixed!important;inset:auto!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important;margin:0!important;height:auto!important;text-align:center!important;max-height:calc(100vh - 32px);overflow:auto;box-sizing:border-box;width:calc(100% - 32px);max-width:440px;border:0;border-radius:16px;padding:48px 28px 32px!important;color:#183b35;background:#fff;box-shadow:0 18px 70px #0004;font:inherit}\n        .eec-switch-access__dialog::backdrop {background:#0009}\n        .eec-switch-access__dialog h3 {margin:0 0 16px!important;color:#183b35!important;font-size:26px!important;font-weight:700;line-height:1.25!important;text-align:center!important}\n        .eec-switch-access__message {color:#183b35!important;font-size:16px!important;line-height:1.6!important;margin:0 0 24px!important;text-align:center!important}\n        .eec-switch-access__close {position:absolute;top:8px;right:10px;border:0;background:transparent;color:#183b35;font-size:28px;cursor:pointer;padding:0!important;width:34px!important;height:34px!important;line-height:34px!important;border-radius:50%;display:flex;align-items:center;justify-content:center}\n        .eec-switch-access__join {display:inline-flex!important;align-items:center;justify-content:center;min-width:160px;box-sizing:border-box;margin:0 auto!important;padding:13px 24px!important;background:#c8f58a!important;color:#183b35!important;border-radius:8px;text-decoration:none!important;font-size:16px!important;font-weight:700;line-height:1.4!important}\n        .eec-switch-access__join[hidden] {display:none!important}\n        <\/style>\n        <script>\n        (function () {\n            const root = document.getElementById(\"eec-switch-access-1\");\n            const form = root.querySelector('form');\n            const submit = root.querySelector('.eec-switch-access__submit');\n            const status = root.querySelector('.eec-switch-access__status');\n            const dialog = root.querySelector('dialog');\n            const message = root.querySelector('.eec-switch-access__message');\n            const join = root.querySelector('.eec-switch-access__join');\n            let busy = false;\n            function showMessage(text, joinRequired) {\n                if (window.parent !== window.self) {\n                    const popup = {type: 'eec-membership-popup', message: text, joinRequired: Boolean(joinRequired)};\n                    window.parent.postMessage(popup, 'https:\/\/switchswitch.com');\n                    window.parent.postMessage(popup, 'https:\/\/www.switchswitch.com');\n                    window.parent.postMessage(popup, 'https:\/\/compare.switchswitch.com');\n                    \/\/ The SwitchSwitch parent page renders the popup outside the iframe.\n                    status.textContent = text;\n                    return;\n                }\n                message.textContent = text;\n                join.hidden = !joinRequired;\n                if (typeof dialog.showModal === 'function') {\n                    if (!dialog.open) dialog.showModal();\n                } else {\n                    dialog.setAttribute('open', '');\n                    status.textContent = text;\n                }\n            }\n            root.querySelector('.eec-switch-access__close').addEventListener('click', function () {\n                if (typeof dialog.close === 'function') dialog.close();\n                else dialog.removeAttribute('open');\n                submit.focus();\n            });\n            dialog.addEventListener('click', function (event) {\n                const box = dialog.getBoundingClientRect();\n                if (event.target === dialog && (event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom)) {\n                    if (typeof dialog.close === 'function') dialog.close();\n                    else dialog.removeAttribute('open');\n                }\n            });\n            form.addEventListener('submit', async function (event) {\n                event.preventDefault();\n                if (busy || !form.reportValidity()) return;\n                busy = true;\n                submit.disabled = true;\n                status.textContent = 'Checking your membership...';\n                const controller = new AbortController();\n                const timeout = setTimeout(function () { controller.abort(); }, 15000);\n                try {\n                    const response = await fetch(form.action, {\n                        method: 'POST', body: new FormData(form), credentials: 'same-origin',\n                        cache: 'no-store', signal: controller.signal\n                    });\n                    const raw = await response.text();\n                    let result;\n                    try { result = JSON.parse(raw); }\n                    catch (error) {\n                        status.textContent = '';\n                        showMessage('The membership service returned an unexpected response (HTTP ' + response.status + '). Please contact support.', false);\n                        return;\n                    }\n                    if (response.ok && result.success && result.data && typeof result.data.redirect_url === 'string' && result.data.redirect_url === 'https:\/\/compare.switchswitch.com\/') {\n                        status.textContent = 'Membership confirmed. Redirecting...';\n                        try {\n                            if (window.top !== window.self) window.top.location.href = result.data.redirect_url;\n                            else window.location.assign(result.data.redirect_url);\n                        } catch (navigationError) {\n                            status.textContent = 'Membership confirmed. Open the tariff page below.';\n                            const link = document.createElement('a');\n                            link.href = result.data.redirect_url; link.target = '_top';\n                            link.textContent = 'Continue to tariff comparison';\n                            link.className = 'eec-switch-access__join';\n                            status.appendChild(link);\n                        }\n                        return;\n                    }\n                    status.textContent = '';\n                    showMessage(result.data && result.data.message ? result.data.message : (result.message || 'Membership service unavailable (HTTP ' + response.status + '). Please contact support.'), Boolean(result.data && result.data.join_required));\n                } catch (error) {\n                    status.textContent = '';\n                    showMessage(error.name === 'AbortError' ? 'The membership check timed out. Please try again.' : 'Unable to connect to the membership service. Please check your connection and try again.', false);\n                } finally {\n                    clearTimeout(timeout);\n                    busy = false;\n                    submit.disabled = false;\n                }\n            });\n        }());\n        <\/script>\n        \n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-with-title","meta":{"footnotes":""},"class_list":["post-105","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/pages\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":3,"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/pages\/105\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/pages\/105\/revisions\/126"}],"wp:attachment":[{"href":"https:\/\/www.evergreenenergyclub.com\/membership\/wp-json\/wp\/v2\/media?parent=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}