{"id":5523,"date":"2022-11-14T21:45:07","date_gmt":"2022-11-14T21:45:07","guid":{"rendered":"https:\/\/serviceobjects.wpaladdin.com\/?page_id=5523"},"modified":"2022-12-14T22:08:21","modified_gmt":"2022-12-14T22:08:21","slug":"ac-javascript-fieldmode-and-mapping","status":"publish","type":"page","link":"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/","title":{"rendered":"AC &#8211; JavaScript fieldMode and Mapping"},"content":{"rendered":"\n<div style=\"height:31px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/#AC-JavaScriptfieldModeandMapping-fieldMode\">fieldMode<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/#AC-JavaScriptfieldModeandMapping-fieldModeExample\">fieldMode Example<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/#AC-JavaScriptfieldModeandMapping-Mapping\">Mapping<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"AC-JavaScriptfieldModeandMapping-fieldMode\">fieldMode<\/h2>\n\n\n\n<ul class=\"is-style-no-bullets-indented-list wp-block-list\">\n<li>fieldMode has four options: SEARCH, POPULATE, COUNTRY and PRESERVE.&nbsp; These options govern the behavior of the fields that are mapped to the control.&nbsp; Using the OR operator &#8220;|&#8221; you can set multiple options per field.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:29px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><thead><tr><th>Fieldmode<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>SEARCH&nbsp;<\/td><td>Used to attach the suggestions to this field so as a user types address suggestions will appear in a dropdown.<\/td><\/tr><tr><td>PRESERVE&nbsp;<\/td><td>Used to preserve fields from being overwritten with results coming back from selecting an address.<\/td><\/tr><tr><td>POPULATE&nbsp;<\/td><td>Used populate fields based on the returned address components.<\/td><\/tr><tr><td>COUNTRY&nbsp;<\/td><td>Used to populate a country dropdown with a list of countries that can be selected to validate from.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"AC-JavaScriptfieldModeandMapping-fieldModeExample\">fieldMode Example<br><\/h2>\n\n\n\n<p><strong>Field Mapping<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var fields = [\n                { element: \"iCompany\", field: \"BusinessName\", mode: so.fieldMode.PRESERVE },\n                { element: \"iAddress1\", field: \"Address1\", mode: so.fieldMode.SEARCH | so.fieldMode.POPULATE },\n                { element: \"iAddress2\", field: \"Address2\", mode: so.fieldMode.POPULATE },\n                { element: \"iAddress3\", field: \"Address3\", mode: so.fieldMode.POPULATE },\n                { element: \"iAddress4\", field: \"Address4\", mode: so.fieldMode.POPULATE },\n                { element: \"iAddress5\", field: \"Address5\", mode: so.fieldMode.POPULATE },\n                { element: \"iUnits\", field: \"SubPremise\", mode: so.fieldMode.POPULATE },\n                { element: \"iLocality\", field: \"Locality\", mode: so.fieldMode.POPULATE },\n                { element: \"iAdminArea\", field: \"AdminArea\", mode: so.fieldMode.POPULATE },\n                { element: \"iPostal\", field: \"PostalCode\", mode: so.fieldMode.POPULATE },\n                { element: \"iCountry\", field: \"Country\", mode: so.fieldMode.COUNTRY}\n             ];    <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"AC-JavaScriptfieldModeandMapping-Mapping\">Mapping<\/h2>\n\n\n\n<ul class=\"is-style-no-bullets-indented-list wp-block-list\">\n<li>The HTML fields from your form can be mapped to anything in the underlying&nbsp;<a href=\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-address-response\/\">JSON object returned from the selection of an address<\/a>.&nbsp; In the case above, in the fieldMode Example, you see many of the more common mappings.&nbsp; The element part is for the ID of the HTML tag on the form and the field part is for the field to map to in the selected address JSON response. Mode, as described above,&nbsp;governs the behavior of the fields that are mapped to the control.&nbsp; This mapping is the first parameter in the Address control object.\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<div style=\"height:6px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Address Control Object<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var DOTSGlobalAddressComplete = new so.Address(fields, options);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>fieldMode Fieldmode Description SEARCH&nbsp; Used to attach the suggestions to this field so as a user types address suggestions will appear in a dropdown. PRESERVE&nbsp; Used to preserve fields from being overwritten with results coming back from selecting an address. POPULATE&nbsp; Used populate fields based on the returned address components. COUNTRY&nbsp; Used to populate a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":2321,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5523","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>AC - JavaScript fieldMode and Mapping<\/title>\n<meta name=\"description\" content=\"fieldMode fieldMode Example Mapping fieldMode fieldMode has four options: SEARCH, POPULATE, COUNTRY and PRESERVE.&nbsp; These options govern the behavior\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AC - JavaScript fieldMode and Mapping\" \/>\n<meta property=\"og:description\" content=\"fieldMode fieldMode Example Mapping fieldMode fieldMode has four options: SEARCH, POPULATE, COUNTRY and PRESERVE.&nbsp; These options govern the behavior\" \/>\n<meta property=\"og:url\" content=\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/\" \/>\n<meta property=\"og:site_name\" content=\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-14T22:08:21+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/\",\"name\":\"AC - JavaScript fieldMode and Mapping\",\"isPartOf\":{\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#website\"},\"datePublished\":\"2022-11-14T21:45:07+00:00\",\"dateModified\":\"2022-12-14T22:08:21+00:00\",\"description\":\"fieldMode fieldMode Example Mapping fieldMode fieldMode has four options: SEARCH, POPULATE, COUNTRY and PRESERVE.&nbsp; These options govern the behavior\",\"breadcrumb\":{\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/test.serviceobjects.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DOTS Global Address Complete\",\"item\":\"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"AC &#8211; JavaScript fieldMode and Mapping\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#website\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/test.serviceobjects.com\/docs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#organization\",\"name\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/test.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png\",\"contentUrl\":\"https:\/\/test.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png\",\"width\":2560,\"height\":1440,\"caption\":\"Service Objects | Contact, Phone, Email Verification | Data Quality Services\"},\"image\":{\"@id\":\"https:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AC - JavaScript fieldMode and Mapping","description":"fieldMode fieldMode Example Mapping fieldMode fieldMode has four options: SEARCH, POPULATE, COUNTRY and PRESERVE.&nbsp; These options govern the behavior","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"AC - JavaScript fieldMode and Mapping","og_description":"fieldMode fieldMode Example Mapping fieldMode fieldMode has four options: SEARCH, POPULATE, COUNTRY and PRESERVE.&nbsp; These options govern the behavior","og_url":"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/","og_site_name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","article_modified_time":"2022-12-14T22:08:21+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/","url":"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/","name":"AC - JavaScript fieldMode and Mapping","isPartOf":{"@id":"https:\/\/test.serviceobjects.com\/docs\/#website"},"datePublished":"2022-11-14T21:45:07+00:00","dateModified":"2022-12-14T22:08:21+00:00","description":"fieldMode fieldMode Example Mapping fieldMode fieldMode has four options: SEARCH, POPULATE, COUNTRY and PRESERVE.&nbsp; These options govern the behavior","breadcrumb":{"@id":"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/ac-javascript-fieldmode-and-mapping\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/test.serviceobjects.com\/docs\/"},{"@type":"ListItem","position":2,"name":"DOTS Global Address Complete","item":"https:\/\/test.serviceobjects.com\/docs\/dots-global-address-complete\/"},{"@type":"ListItem","position":3,"name":"AC &#8211; JavaScript fieldMode and Mapping"}]},{"@type":"WebSite","@id":"https:\/\/test.serviceobjects.com\/docs\/#website","url":"https:\/\/test.serviceobjects.com\/docs\/","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","description":"","publisher":{"@id":"https:\/\/test.serviceobjects.com\/docs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/test.serviceobjects.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/test.serviceobjects.com\/docs\/#organization","name":"Service Objects | Contact, Phone, Email Verification | Data Quality Services","url":"https:\/\/test.serviceobjects.com\/docs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/","url":"https:\/\/test.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png","contentUrl":"https:\/\/test.serviceobjects.com\/docs\/wp-content\/uploads\/2022\/08\/SO-logo-2560px-transparent.png","width":2560,"height":1440,"caption":"Service Objects | Contact, Phone, Email Verification | Data Quality Services"},"image":{"@id":"https:\/\/test.serviceobjects.com\/docs\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/5523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/comments?post=5523"}],"version-history":[{"count":13,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/5523\/revisions"}],"predecessor-version":[{"id":7908,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/5523\/revisions\/7908"}],"up":[{"embeddable":true,"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/pages\/2321"}],"wp:attachment":[{"href":"https:\/\/test.serviceobjects.com\/docs\/wp-json\/wp\/v2\/media?parent=5523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}