{"id":476,"date":"2026-08-21T12:46:20","date_gmt":"2026-08-21T07:16:20","guid":{"rendered":"https:\/\/vipashafarms.in\/?page_id=476"},"modified":"2026-08-21T15:06:04","modified_gmt":"2026-08-21T09:36:04","slug":"new-field","status":"publish","type":"page","link":"https:\/\/vipashafarms.in\/pa\/new-field\/","title":{"rendered":"New Field"},"content":{"rendered":"\n\n\n\n\n<script>\ndocument.addEventListener('DOMContentLoaded', function () {\n\n    const latitude =\n        sessionStorage.getItem('vf_field_latitude');\n\n    const longitude =\n        sessionStorage.getItem('vf_field_longitude');\n\n    if (!latitude || !longitude) {\n        return;\n    }\n\n    function fillGPS() {\n\n        const lat =\n            document.getElementById(\n                'acff-post-field_6a87ee538c33e'\n            );\n\n        const lng =\n            document.getElementById(\n                'acff-post-field_6a87ee688c33f'\n            );\n\n        if (lat) {\n            lat.value = latitude;\n\n            lat.dispatchEvent(\n                new Event('input', {\n                    bubbles: true\n                })\n            );\n\n            lat.dispatchEvent(\n                new Event('change', {\n                    bubbles: true\n                })\n            );\n        }\n\n        if (lng) {\n            lng.value = longitude;\n\n            lng.dispatchEvent(\n                new Event('input', {\n                    bubbles: true\n                })\n            );\n\n            lng.dispatchEvent(\n                new Event('change', {\n                    bubbles: true\n                })\n            );\n        }\n\n        if (lat && lng) {\n\n            sessionStorage.removeItem(\n                'vf_field_latitude'\n            );\n\n            sessionStorage.removeItem(\n                'vf_field_longitude'\n            );\n\n            return true;\n        }\n\n        return false;\n    }\n\n    let attempts = 0;\n\n    const timer = setInterval(function () {\n\n        attempts++;\n\n        if (fillGPS() || attempts >= 30) {\n            clearInterval(timer);\n        }\n\n    }, 500);\n\n});\n<\/script>\n<script>\ndocument.addEventListener('DOMContentLoaded', function () {\n\n    const latitude =\n        sessionStorage.getItem('vf_field_latitude');\n\n    const longitude =\n        sessionStorage.getItem('vf_field_longitude');\n\n    if (!latitude || !longitude) {\n        return;\n    }\n\n    fetch(\n        'https:\/\/nominatim.openstreetmap.org\/reverse?format=jsonv2&lat=' +\n        encodeURIComponent(latitude) +\n        '&lon=' +\n        encodeURIComponent(longitude) +\n        '&zoom=18&addressdetails=1',\n        {\n            headers: {\n                'Accept': 'application\/json'\n            }\n        }\n    )\n    .then(function (response) {\n        return response.json();\n    })\n    .then(function (data) {\n\n        if (!data || !data.address) {\n            return;\n        }\n\n        const address = data.address;\n\n        \/*\n         * Find the actual Frontend Admin fields\n         *\/\n\n        const locationField =\n            document.querySelector(\n                '[data-name=\"field_location\"] input'\n            );\n\n        const villageField =\n            document.querySelector(\n                '[data-name=\"field_village\"] input'\n            );\n\n        const districtField =\n            document.querySelector(\n                '[data-name=\"field_district\"] input'\n            );\n\n        const stateField =\n            document.querySelector(\n                '[data-name=\"field_state\"] input'\n            );\n\n        const countryField =\n            document.querySelector(\n                '[data-name=\"field_country\"] input'\n            );\n\n\n        \/*\n         * Village \/ locality\n         *\/\n\n        const village =\n            address.village ||\n            address.hamlet ||\n            address.town ||\n            address.city ||\n            address.suburb ||\n            '';\n\n\n        \/*\n         * District\n         *\/\n\n        const district =\n            address.state_district ||\n            address.district ||\n            '';\n\n\n        \/*\n         * State\n         *\/\n\n        const state =\n            address.state ||\n            '';\n\n\n        \/*\n         * Country\n         *\/\n\n        const country =\n            address.country ||\n            '';\n\n\n        \/*\n         * Location \/ road\n         *\/\n\n        const location =\n            address.road ||\n            address.neighbourhood ||\n            address.suburb ||\n            address.locality ||\n            '';\n\n\n        function setField(field, value) {\n\n            if (!field || !value) {\n                return;\n            }\n\n            field.value = value;\n\n            field.dispatchEvent(\n                new Event('input', {\n                    bubbles: true\n                })\n            );\n\n            field.dispatchEvent(\n                new Event('change', {\n                    bubbles: true\n                })\n            );\n        }\n\n\n        setField(locationField, location);\n\n        setField(villageField, village);\n\n        setField(districtField, district);\n\n        setField(stateField, state);\n\n        setField(countryField, country);\n\n    })\n    .catch(function (error) {\n\n        console.log(\n            'Reverse geocoding failed:',\n            error\n        );\n\n    });\n\n});\n<\/script>\n<script>\ndocument.addEventListener('DOMContentLoaded', function () {\n\n    const acreage =\n        sessionStorage.getItem('vf_field_acreage');\n\n    if (!acreage) {\n        return;\n    }\n\n    function fillAcreage() {\n\n        const acreageField =\n            document.getElementById(\n                'acff-post-field_6a7c9eaea400b'\n            );\n\n        if (!acreageField) {\n            return false;\n        }\n\n        acreageField.value = acreage;\n\n        acreageField.dispatchEvent(\n            new Event('input', {\n                bubbles: true\n            })\n        );\n\n        acreageField.dispatchEvent(\n            new Event('change', {\n                bubbles: true\n            })\n        );\n\n        return true;\n    }\n\n    let attempts = 0;\n\n    const timer = setInterval(function () {\n\n        attempts++;\n\n        if (fillAcreage() || attempts >= 30) {\n\n            clearInterval(timer);\n\n        }\n\n    }, 500);\n\n});\n<\/script>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-476","page","type-page","status-publish","hentry"],"acf":[],"_hostinger_reach_plugin_has_subscription_block":false,"_hostinger_reach_plugin_is_elementor":false,"_links":{"self":[{"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/pages\/476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/comments?post=476"}],"version-history":[{"count":5,"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/pages\/476\/revisions"}],"predecessor-version":[{"id":563,"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/pages\/476\/revisions\/563"}],"wp:attachment":[{"href":"https:\/\/vipashafarms.in\/pa\/wp-json\/wp\/v2\/media?parent=476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}