CINXE.COM
Find Your Solution | Robert Half
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"/> <script defer="defer" type="text/javascript" src="/.rum/@adobe/helix-rum-js@%5E2/dist/rum-standalone.js"></script> <link rel="icon" type="image/x-icon" href="/content/dam/roberthalf/favicon.png"/> <!-- Preconnect links --> <link rel="preconnect" href="https://www.google.com"/> <link rel="preconnect" href="https://cdn.cookielaw.org"/> <link rel="preconnect" href="https://seoab.io"/> <link rel="dns-prefetch" href="https://prdmir-online.roberthalf.com"/> <link rel="preconnect" href="https://www.googletagmanager.com"/> <link rel="preconnect" href="https://resources.roberthalfonline.com"/> <meta name="template" content="full-width-page-content"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <meta name="robots" content="noindex, nofollow"/> <link rel="canonical" href="https://www.roberthalf.com/us/en/hire-talent/form"/> <script> var salaryGuideGatingProperties = '{ enabled: false, redirectLocation: "null", key: "null" }'; if (salaryGuideGatingProperties.redirectLocation && !salaryGuideGatingProperties.redirectLocation.endsWith(".html")) { salaryGuideGatingProperties.redirectLocation += ".html"; } window.salaryGuideGatingProperties = salaryGuideGatingProperties; window.passesSalaryGuideGating = function() { if ( salaryGuideGatingProperties.enabled != undefined && salaryGuideGatingProperties.enabled.toString().toLowerCase() === "true" && window.localStorage.getItem("salaryGuideGatingKey") != salaryGuideGatingProperties.key && window.location.pathname != salaryGuideGatingProperties.redirectLocation ) { return false; } return true; } </script> <link media="print" rel="stylesheet" href="/etc.clientlibs/roberthalf/clientlibs/clientlib-base.lc-aadab028fda76fa101c57a36121a8a16-lc.min.css" type="text/css"> <script> let css = document.querySelector('link[media="print"]'); if(css) { css.media = "all"; } </script> <script> // window function to fetch UPO function getUPO() { let upoString = localStorage.getItem("unifiedProfileObject"); if (upoString === null || upoString === undefined) { return {}; } let parsedObject = decodeURIComponent(atob(upoString)); return JSON.parse(parsedObject); } // window function to update UPO async function setUPO(unifiedProfileObject) { const encodedString = btoa(encodeURIComponent(JSON.stringify(unifiedProfileObject))); localStorage.setItem("unifiedProfileObject", encodedString); await window.yieldToMain?.(); } </script> <script> window.addEventListener("rhcl-initialized", () => { window.setTimeout(handleClLoaded, 250); }); // Backup in case events do not sync up window.setTimeout(handleClLoaded, 5000); function handleClLoaded() { document.querySelector('style[data-source="rh-slot-style"]')?.remove(); } </script> <link rel="preload stylesheet" as="style" href="https://resources.roberthalfonline.com/rhcl/v28.1.0/assets/libraries/fontawesome6/css/all.css"/> <link rel="preload stylesheet" as="style" href="https://resources.roberthalfonline.com/rhcl/v28.1.0/css/rhcl.css"/> <link rel="preload" href="https://resources.roberthalfonline.com/rhcl/v28.1.0/assets/Fonts/NotoSans/notosans-display-light-webfont.woff2" as="font" crossorigin/> <link rel="preload" href="https://resources.roberthalfonline.com/rhcl/v28.1.0/assets/Fonts/NotoSans/notosans-display-webfont.woff2" as="font" crossorigin/> <link rel="preload" href="https://resources.roberthalfonline.com/rhcl/v28.1.0/assets/Fonts/NotoSans/notosans-regular-webfont.woff2" as="font" crossorigin/> <link rel="preload" href="https://resources.roberthalfonline.com/rhcl/v28.1.0/assets/Fonts/fontawesome6/fa-regular-400.woff2" as="font" crossorigin/> <script type="module" src="https://resources.roberthalfonline.com/rhcl/v28.1.0/lib/rhcl.esm.js" async></script> <style data-source="rh-slot-style"> [slot], rhcl-typography, rhcl-heading, rhcl-typeahead, .rhcl-typography, .rhcl-focused-search-block, .rhcl-block-paginated-feature, rhcl-modal, rhcl-block-stacking-cards, rhcl-block-focused-search, rhcl-search-bar, rhcl-button-group, rhcl-block-paired-content, .cmp-rhcl-focused-block-wrapper .cmp-rhcl-stacking-cards-block-wrapper, .cmp-container { visibility: hidden; } [slot]{font-family: "Noto Sans Regular";} h1[slot],h2[slot],h3[slot],h4[slot],h5[slot],h6[slot],p[slot]{ font-family: "Noto Sans Display";} </style> <script type="text/javascript"> window.pageObj = {}; izCountries = 'gb,de,fr,ch,cn,jp,cl,at,ae,be,nl,nz,hk,br,sg,au,lu'.split(","); naCountries = 'us,ca'.split(","); luxCountries = 'us,ca,de,be,gb,br'.split(","); euCountries = 'gb,de,fr,ch,at,ae,be,nl'.split(","); aemSettings ={ "rh_account_creation": { accountCreateResendEmailEndpoint: 'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/salesforce\u002Dapi\/resend\u002Demail', accountRoutingMap: { "email": '\/us\/en\/sign\u002Dup\/create\u002Daccount', "resume": '\/us\/en\/find\u002Djobs\/upload\u002Dresume\/app', "candidate-email": '\/us\/en\/find\u002Djobs\/upload\u002Dresume\/email\u002Dverification\/app', "msjo": '\/us\/en\/find\u002Dyour\u002Dsolution\/app', "login": 'https:\/\/online.roberthalf.com\/s\/login?', "pendingAccount": '\/us\/en\/sign\u002Dup\/create\u002Daccount', // "expiredVerification": '\/us\/en\/sign\u002Dup\/create\u002Daccount', "candidateExpired": '\/us\/en\/find\u002Djobs\/upload\u002Dresume\/app', "clientExpired": '\/us\/en\/hire\u002Dtalent\/form', "hasWebAccountClientOnly": 'https:\/\/online.roberthalf.com\/s\/login?', "hasWebAccount": 'https:\/\/online.roberthalf.com\/s\/login?', } }, "rh_candidate_apply": { aiConsentEndpoint: 'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/update\u002Dai\u002Dconsent', accountCreateEndpoint:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/create\u002Daccount', directAccountCreateEndpoint: 'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/create\u002Daccount', applyEndpoint:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/job\u002Dapply', resendEmailEndpoint: 'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/salesforce\u002Dapi\/resend\u002Demail', submitResumeEndpoint:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/submit\u002Dresume', resumeParseEndpoint:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/parse\u002Dresume\/parse', xingUploadResumeEndpoint:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/xing\u002Dresume', linkedInUploadResumeEndpoint:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/job\u002Dapply\/linkedin\u002Dresume', geolocationEndpoint:'https:\/\/gen.api.roberthalfonline.com\/geocode\/getGeoByRegion?country_code=', googleGeoCodeEndpoint:'https:\/\/gen.api.roberthalfonline.com\/googlegeo\/getGeocode?address=', timezoneEndpoint:'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/timezone\/getTimezone', fetchSkills:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/fetch\u002Dskills', patchSkills:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/patch\u002Dskills', fetchResume:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/job\u002Dapply\/fetch\u002Dresume', jobTypeValuesEndpoint:'https:\/\/gen.api.roberthalfonline.com\/iz\u002Dbranch\u002Dservice\/findJobTypeList', specializationValuesEndpoint:'https:\/\/gen.api.roberthalfonline.com\/iz\u002Dbranch\u002Dservice\/findSpecializationList', nearestOfficeValuesEndpoint:'https:\/\/gen.api.roberthalfonline.com\/iz\u002Dbranch\u002Dservice\/findOfficeList', xingPluginScript:'https:\/\/www.xing\u002Dshare.com\/plugins\/login_plugin.js', xingId:'82ac2657946cd0af3fa4' }, "rh_client_payment" :{ profileId:'EB9BBCE6\u002D70F7\u002D41BB\u002DB03B\u002DA8C27BB01D8E', accessKey: '5a4ab6d640e03d4dba86c1f9da33cf0b', maintenanceMode: 'false', cybersourceEndpoint:'https:\/\/secureacceptance.cybersource.com\/embedded\/pay', invoiceEndpoint:'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/cpp', }, "rh_job_search": { getAndSetSavedJobsEndpoint:'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/get\u002Dand\u002Dset\u002Djob\/query', jobAlertsEndpoint:'https:\/\/prd\u002Ddr.ma.api.roberthalfonline.com\/job\u002Dalerts\/subscribe', jobInterestEndpoint:'https:\/\/prd\u002Ddr.jps.api.roberthalfonline.com\/presented\u002Djob\/jobinterest', jobSearchEndpoint:'https:\/\/prd\u002Ddr.jps.api.roberthalfonline.com\/search', quickApplyEndpoint:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/quick\u002Dapply', signInLink:'https:\/\/www.roberthalf.com\/login.rhlogin', jobSearchLocationTypeaheadEndpoint:'https:\/\/gen.api.roberthalfonline.com\/auto\u002Dcomplete\u002Daem\/search', feedbackDestinationEditAvailability:'avail', feedbackDestinationEditLocation:'loc', feedbackDestinationEditPayPreference:'pref', feedbackDestinationEditSkills:'skills', jobInterestFeedback:'https:\/\/prd\u002Ddr.rf.api.roberthalfonline.com\/candidate\u002Dapply\/feedback' }, "rh_multistep_job_order" :{ leadsProcessingEndpoint:'https:\/\/prd\u002Ddr.lp.api.roberthalfonline.com\/proxy\u002Dlead\u002Dprocessing\/send', jobFunctionTypeahead:'https:\/\/gen.api.roberthalfonline.com\/auto\u002Dcomplete\u002Daem\/job\u002Dfunction', skillSearch: 'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/sf\u002Dskills\/skillSearch', skillsRecommendation: 'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/sf\u002Dskills\/skillRecommendation', sfccRedirectUrl: 'https:\/\/online.roberthalf.com' }, "rh_candidate_discovery": { candidateJobTitleTypeaheadEndpoint: 'https:\/\/gen.api.roberthalfonline.com\/auto\u002Dcomplete\u002Daem\/job\u002Dfunction', candidateLocationTypeaheadEndpoint: 'https:\/\/gen.api.roberthalfonline.com\/auto\u002Dcomplete\u002Daem\/search' }, "rh_common": { accountCheckEndpoint:'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/check\u002Dstatus\/check?candidate_email=', geolocationEndpoint: 'https:\/\/gen.api.roberthalfonline.com\/googlegeo\/getReverseGeocode', personDetailsEndpoint: '\/bin\/personDetails', recaptchaEndpoint: 'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/recaptcha\/verify\u002Dtoken', page_section: 'Multistep Job Order', page_user_type: 'Client', page_type: '', isLuxCountry: 'true' } }; var articleDataLayer = { blog_type:'', industry_name :'', country_code :'', language :'', entityid :'', author_name :'', thumbnail_url :'', title :'', description :'', employment_type :'', published_date :'', page_url :'', categories :'', Article_tag :'' }; pageObj.__extrasettings__ = { language: 'en', country: 'us' }; </script> <script type="text/javascript"> aemSettings.rh_common.recaptchaEndpoint = 'https:\/\/prd\u002Ddr.gen.api.roberthalfonline.com\/recaptcha\/verify\u002Dtoken'; </script> <script> let readyFn = window.ready; if (!readyFn) { readyFn = function ready(fn) { if (typeof fn !== 'function') { throw new Error('Argument passed to ready should be a function'); } if (document.readyState != 'loading') { fn(); } else if (document.addEventListener) { document.addEventListener('DOMContentLoaded', fn, { once: true // A boolean value indicating that the listener should be invoked at most once after being added. If true, the listener would be automatically removed when invoked. }); } else { document.attachEvent('onreadystatechange', function () { if (document.readyState != 'loading') fn(); }); } } } readyFn(() => { let attempts = 0; // Initialize a counter const waitForEinsteinBot = setInterval(() => { attempts++; // Increment the counter each time the interval runs if (typeof initEinsteinBot === "function") { clearInterval(waitForEinsteinBot); try { const enableChat = aemSettings?.rh_common?.enableChat; const chatbot = document.querySelector(".chatbot"); const disableChatAutoInit = document.querySelector( "#disableChatAutoInit" ); if (enableChat && !chatbot && !disableChatAutoInit) { initEinsteinBot(); // CLS fix for chat button icon const styleEl = document.createElement("style"); styleEl.id = "chatButtonSize"; styleEl.innerHTML = ".embeddedServiceHelpButton .helpButton .uiButton {width: 115px; height: 50px;}"; document.head.appendChild(styleEl); } else { const styleEl = document.createElement("style"); styleEl.id = "hideChat"; styleEl.innerHTML = ".embeddedServiceHelpButton {display: none !important; }"; document.head.appendChild(styleEl); // will be removed by frontend when the chat is shown } } catch (error) { console.error(error); } } else if (attempts >= 10) { // If counter reaches 10, clear the interval clearInterval(waitForEinsteinBot); console.error("initEinsteinBot not loaded after 10 attempts"); } }, 100); // Check every 100ms }); aemSettings.rh_common.enableChat = "true"; </script> <script type="text/javascript" src="https://rh.my.salesforce.com/embeddedservice/5.0/esw.min.js" defer></script> <script type="text/javascript" src="https://rh.my.salesforce-sites.com/liveagent/EinsteinBotEmbedJS" defer></script> <title>Find Your Solution | Robert Half</title> <meta property="og:locale" content="en_US"/> <meta property="og:updated_time" content="2024-10-08T22:58:00+0000"/> <meta property="og:type" content="website"/> <meta property="og:site_name" content="Robert Half"/> <meta property="og:image" content="https://www.roberthalf.com/content/dam/roberthalf/rh.png"/> <meta property="og:image:type" content="image/png"/> <meta property="og:image:width" content="500"/> <meta property="og:image:height" content="500"/> <meta property="og:image:alt" content="rh-logo"/> <meta property="og:url" content="https://www.roberthalf.com/us/en/hire-talent/form"/> <meta property="og:title" content="Find Your Solution"/> <meta property="og:description"/> <meta name="title" content="Find Your Solution"/> <meta property="og:publication_time" content="2024-07-20T01:11:54+0000"/> <script> (function() { window.SM_SPLITSIGNAL = window.SM_SPLITSIGNAL || {ready: false} window.addEventListener( 'splitsignal.initialized', function() { if (!aemSettings.isReactApp) { window.SM_SPLITSIGNAL.ready = true } } ) var script = document.createElement('script') script.id = 'a4a03573-e3f5-4f01-8963-395af304b0b2' script.src = 'https://seoab.io/react/' script.type = 'module' script.defer = true document.head.appendChild(script) })() </script> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebPage", "name" : "Find Your Solution", "url": "https://www.roberthalf.com/us/en/hire-talent/form", "isPartOf": { "@type": "WebSite", "name": "Robert Half", "url": "https://www.roberthalf.com/us/en", "publisher": { "type": "Organization", "name": "Robert Half", "legalName": "Robert Half Inc.", "url": "https://www.roberthalf.com/us/en", "@id": "https://www.roberthalf.com/us/en" } }, "mainEntity": [""], "mainEntityOfPage": "https://www.roberthalf.com/us/en/hire-talent/form" } </script> <script async defer src="/etc.clientlibs/roberthalf/clientlibs/clientlib-clientId.lc-816e4fe05c72b7567d3214430c031c84-lc.min.js"></script> <script type="text/javascript"> function ready(a){if("function"!==typeof a)throw Error("Argument passed to ready should be a function");"loading"!=document.readyState?a():document.addEventListener?document.addEventListener("DOMContentLoaded",a,{once:!0}):document.attachEvent("onreadystatechange",function(){"loading"!=document.readyState&&a()})}; </script> <script async defer src="/etc.clientlibs/roberthalf/clientlibs/clientlib-base.lc-c2e6badfafdca9d6562529f92211112b-lc.min.js"></script> <!-- Language And Country en-us Country us--> <!-- OptanonConsentNoticeStart --> <script id="onetrust-cdn" src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" data-language="en-us" type="text/javascript" charset="UTF-8" data-domain-script="2a31b00d-1ad7-4a6f-aace-0bc849755db0" async defer></script> <script type="text/javascript"> function OptanonWrapper() { checkConsentValues(); } </script> <!-- OptanonConsentNoticeEnd --> <!-- Check Cookie Value Start--> <script type="text/javascript"> var isPerformanceCookiesChecked = false; function checkConsentValues() { var consentRatio = getOptanonConsentRatio(); if (consentRatio != null && consentRatio.includes("2:1")) { isPerformanceCookiesChecked = true; var oneTrustEvent = new CustomEvent("rh-onetrust-accepted", { "detail": "vanilla js version of one trust event" }); var oneTrustJSEvent = new CustomEvent("rh-onetrust-accepted-js", { "detail": "vanilla js version of one trust event" }); document.dispatchEvent(oneTrustJSEvent); document.dispatchEvent(oneTrustEvent); } } window.setTimeout(checkConsentValues, 2000); function getCookie(cname) { var name = cname + '='; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return false; } function getOptanonConsentRatio() { const queryParams = new URLSearchParams(getCookie("OptanonConsent")); return queryParams.get('groups'); } </script> <!-- Check Cookie Value End--> <!-- TealiumStart --> <script type="text/javascript"> var utag_data = {"pageType":null,"pageSection":"section","pageName":"English","countryCode":"us","currencyCode":"USD"}; // This script is provided, don't change without consulting the analytics team (function (a, b, c, d) { a = 'https://tags.roberthalf.com/usa2/prod/utag.js'; b = document; c = 'script'; d = b.createElement(c); d.src = a; d.type = 'text/java' + c; d.async = true; a = b.getElementsByTagName(c)[0]; a.parentNode.insertBefore(d, a); })(); </script> <script async defer src="/etc.clientlibs/roberthalf/clientlibs/clientlib-tealium.lc-4045ddcc1948e9043decb7264c4cb7f5-lc.min.js"></script> <!-- TealiumEnd --> <!-- InvocaStart --> <script> window.setTimeout(loadInvoca, 2000); function loadInvoca() { if (isPerformanceCookiesChecked) { // This script is provided, don't change without consulting the analytics team (function (i, n, v, o, c, a) { i.InvocaTagId = o; var s = n.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = ('https:' === n.location.protocol ? 'https://' : 'http://') + v; var fs = n.getElementsByTagName('script')[0]; fs.parentNode.insertBefore(s, fs); })(window, document, 'solutions.invocacdn.com/js/invoca-latest.min.js', '479/2192400593'); } else { document.addEventListener("rh-onetrust-accepted", loadInvoca); } } </script> <!-- InvocaEnd --> <script> (function(win, doc, style, timeout) { var STYLE_ID = 'at-body-style'; var isTargetLoading = false; function getParent() { return doc.getElementsByTagName('head')[0]; } function addStyle(parent, id, def) { if (!parent) { return; } var style = doc.createElement('style'); style.id = id; style.innerHTML = def; parent.appendChild(style); } function removeStyle(parent, id) { if (!parent) { return; } var style = doc.getElementById(id); if (!style) { return; } parent.removeChild(style); } addStyle(getParent(), STYLE_ID, style); setTimeout(function() { if (!isTargetLoading) { removeStyle(getParent(), STYLE_ID); } else { var removePrehidingMaxTimeout = setTimeout(function () { removeStyle(getParent(), STYLE_ID); }, timeout); document.addEventListener("utag-sync-loaded", function () { removeStyle(getParent(), STYLE_ID); clearTimeout(removePrehidingMaxTimeout); }); } }, timeout); document.addEventListener("utag-sync-loading", function (event) { isTargetLoading = true; }); }(window, document, "body {opacity: 0 !important}", 2000)); </script> <!-- UtagStart --> <script id="load-target"> var isPerformanceCookiesCheckedForTarget = false; function loadTarget () { var headElementForTarget = document.getElementsByTagName("head")[0]; var targetConsentRatio = getOptanonConsentRatio(); var preHidingStyleComponent = document.getElementById("at-body-style"); if (!preHidingStyleComponent) { return; } if (targetConsentRatio != null && targetConsentRatio.includes("2:0")) { if (preHidingStyleComponent) { headElementForTarget.removeChild(preHidingStyleComponent); } return; } if (targetConsentRatio != null && targetConsentRatio.includes("2:1")) { isPerformanceCookiesCheckedForTarget = true; } if (isPerformanceCookiesCheckedForTarget) { var s = document.createElement("script"); s.id = "adobe-target-utag-sync"; s.src = "https:\/\/tags.roberthalf.com\/usa2\/prod\/utag.sync.js"; s.async = true; s.onload = function () { document.dispatchEvent(new CustomEvent("utag-sync-loaded", { "detail": "utag.sync.js finished loading"})); } headElementForTarget.append(s); document.dispatchEvent(new CustomEvent("utag-sync-loading", { "detail": "utag.sync.js inserted into the head"})); } if (!targetConsentRatio && !isPerformanceCookiesCheckedForTarget) { setTimeout(loadTarget, 100); } } var otScript = document.getElementById("onetrust-cdn"); if (otScript) { otScript.onload = function () { loadTarget(); } } else { setTimeout(loadTarget, 100); } </script> <!-- UtagEnd --> <script async src="/etc.clientlibs/core/wcm/components/commons/datalayer/v2/clientlibs/core.wcm.components.commons.datalayer.v2.lc-1e0136bad0acfb78be509234578e44f9-lc.min.js"></script> <script async src="/etc.clientlibs/core/wcm/components/commons/datalayer/acdl/core.wcm.components.commons.datalayer.acdl.lc-bf921af342fd2c40139671dbf0920a1f-lc.min.js"></script> </head> <body class="page basicpage" id="page-1ddd507133" data-cmp-link-accessibility-enabled data-cmp-link-accessibility-text="opens in a new tab" data-cmp-data-layer-enabled data-cmp-data-layer-name="adobeDataLayer"> <script> var dataLayerName = 'adobeDataLayer' || 'adobeDataLayer'; window[dataLayerName] = window[dataLayerName] || []; window[dataLayerName].push({ page: JSON.parse("{\x22page\u002D1ddd507133\x22:{\x22@type\x22:\x22roberthalf\/components\/structure\/page\/page\x22,\x22repo:modifyDate\x22:\x222024\u002D10\u002D08T22:58:00Z\x22,\x22dc:title\x22:\x22JO Wizard Flow (MSJO)\x22,\x22xdm:template\x22:\x22\/conf\/roberthalf\/settings\/wcm\/templates\/full\u002Dwidth\u002Dpage\u002Dcontent\x22,\x22xdm:language\x22:\x22en\u002DUS\x22,\x22xdm:tags\x22:[],\x22repo:path\x22:\x22\/content\/roberthalf\/us\/en\/hire\u002Dtalent\/form.html\x22}}"), event:'cmp:show', eventInfo: { path: 'page.page\u002D1ddd507133' } }); </script> <rhcl-base path="https://resources.roberthalfonline.com/rhcl/v28.1.0" locale="en-US"></rhcl-base> <div class="root container-fluid cmp-container"> <div id="container-da5f14ae6e" class="cmp-container"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="experiencefragment aem-GridColumn aem-GridColumn--default--12"> <div id="experiencefragment-ca4ead7c74" class="cmp-experiencefragment cmp-experiencefragment--header"> <div id="container-d717616a81" class="cmp-container"> <div class="root container-fluid cmp-container"> <div class="cq-placeholder" data-emptytext="Navigation: Header"> </div> <div id="rh-nav" class="cmp-container"> <div id="skipToMainContent" data-skipToMainContent-label="Skip To Main Content"></div> <script> // needs to run once on any page with a nav header function identifyFirstComponent() { try { const excludedTags = ["RHCL-BLOCK-NAVIGATION", "RHCL-BLOCK-COOKIE-BAR"]; const rhclContentBlocks = Array.from(document.querySelectorAll("body *")) .filter( (elem) => elem.tagName.startsWith("RHCL-BLOCK") || elem.classList.contains("rh-homepage-hero") || elem.classList.contains("rh-first-component") ) .filter((elem) => !excludedTags.includes(elem.tagName)); const maxTries = 10; let tries = 1; const nav = document.querySelector("rhcl-block-navigation"); if (nav && nav.getAttribute("background") == "transparent") { // find first component if (rhclContentBlocks.length > 0) { rhclContentBlocks[0].setAttribute( "data-first-component-padded", "true" ); } else { tries++; if (tries <= maxTries) { setTimeout(identifyFirstComponent, 500); } } } else { const hero = document.querySelector(".rh-homepage-hero"); if (hero) { hero.removeAttribute("data-first-component-padded"); } } } catch (error) { console.log(error); } } window.ready(() => { window.dispatchEvent(new Event("scroll")); identifyFirstComponent(); }); </script> <rhcl-block-navigation branding-destination="/us/en" account-menu-label="My Account" branding-external="false" branding-title="Robert Half" sign-in-label="Sign in" sign-in-destination="/login.rhlogin?language=en&country=us" background="white" theme="light"> <rhcl-navigation-item slot="navigation-item" destination="/us/en/find-jobs" label="Find Jobs" cta-heading-label="Control your career. Find the right role for you - remote, hybrid or on-site." cta-label="Find your next job" cta-destination="/us/en/find-jobs" cta-external="false" cta-variant="primary"> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-findjobs?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-findjobs?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-findjobs?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-findjobs?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <rhcl-list-base slot="secondary-nav-content"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/jobs">Browse jobs</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/find-jobs/upload-resume">Find the right job type for you</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/find-jobs/partner">Explore how we help job seekers</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="gradient-content" headline="Areas of expertise" layout="column"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/accounting-finance">Finance and Accounting</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/tech-it">Technology</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/marketing-creative">Marketing and Creative</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/administrative">Administrative and Customer Support</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/legal">Legal</a> </rhcl-menu-link> </rhcl-list-base> </rhcl-navigation-item> <rhcl-navigation-item slot="navigation-item" destination="/us/en/hire-talent" label="Hire Talent" cta-heading-label="We're ready to help you hire talent at every level, from office support roles to C-suite." cta-label="Hire talent" cta-destination="/us/en/hire-talent" cta-external="false" cta-variant="primary"> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-hiretalent?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-hiretalent?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-hiretalent?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-hiretalent?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <rhcl-list-base slot="secondary-nav-content" headline="Staffing"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/hire-talent/find-candidates">Preview candidates</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/hire-talent/flexible-staffing">Contract talent</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/hire-talent/full-time-staffing">Permanent talent</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/hire-talent/partner">Learn how we work with you</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="secondary-nav-content" headline="Retained services"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/hire-talent/executive-search">Executive search</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="gradient-content" headline="Areas of expertise" layout="column"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/accounting-finance">Finance and Accounting</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/tech-it">Technology</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/marketing-creative">Marketing and Creative</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/administrative">Administrative and Customer Support</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/legal">Legal</a> </rhcl-menu-link> </rhcl-list-base> </rhcl-navigation-item> <rhcl-navigation-item slot="navigation-item" destination="/us/en/consulting" label="Explore Consulting Solutions" cta-heading-label="See how our consulting capabilities can help transform your business." cta-label="Explore consulting solutions" cta-destination="/us/en/consulting" cta-external="false" cta-variant="primary"> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-exploreconsultingsolutions?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-exploreconsultingsolutions?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-exploreconsultingsolutions?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-exploreconsultingsolutions?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <rhcl-list-base slot="gradient-content" headline="AREAS OF EXPERTISE" layout="column-two"> <rhcl-menu-link slot="item" description="Cloud • Cybersecurity • Data & Analytics • Data Privacy • Intelligent Automation • IT Service Desk"> <a slot="item" href="/us/en/consulting/tech">Technology</a> </rhcl-menu-link> <rhcl-menu-link slot="item" description="Internal Audit • Regulatory Compliance • Financial Crimes Compliance • Risk Management • Sarbanes-Oxley"> <a slot="item" href="/us/en/consulting/risk-compliance-audit">Risk, Audit and Compliance</a> </rhcl-menu-link> <rhcl-menu-link slot="item" description="Finance Transformation • Process Optimization • Finance Technology & Data • Reporting & Compliance • Cost & Performance Management"> <a slot="item" href="/us/en/consulting/finance">Finance and Accounting</a> </rhcl-menu-link> <rhcl-menu-link slot="item" description="Digital Transformation • Marketing Services • Marketing Technology • Creative and Design"> <a slot="item" href="/us/en/consulting/digital">Digital, Marketing and Customer Experience</a> </rhcl-menu-link> <rhcl-menu-link slot="item" description="Data Privacy • Legal Consulting • Transaction Services"> <a slot="item" href="/us/en/consulting/legal">Legal</a> </rhcl-menu-link> <rhcl-menu-link slot="item" description="Contact Centers • Sustainability • Operational Effectiveness • Supply Chain • Sourcing & Procurement"> <a slot="item" href="/us/en/consulting/administrative">Operations</a> </rhcl-menu-link> <rhcl-menu-link slot="item" description="HR Transformation • Employee Experience • Managed Talent • Future of Work • Organizational Transformation"> <a slot="item" href="/us/en/consulting/human-resources">Human Resources</a> </rhcl-menu-link> </rhcl-list-base> </rhcl-navigation-item> <rhcl-navigation-item slot="navigation-item" destination="/us/en/insights" label="Discover Insights" cta-heading-label="Make smarter decisions with the latest hiring trends and career insights." cta-label="Discover Insights" cta-destination="/us/en/insights" cta-external="false" cta-variant="primary"> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-discoverinsights?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-discoverinsights?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-discoverinsights?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-nav-discoverinsights?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <rhcl-list-base slot="secondary-nav-content"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/salary-guide">2025 Salary Guide</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/salary-hiring-trends/demand-for-skilled-talent">Demand for Skilled Talent Report</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/building-tech-teams">Building Future-Forward Tech Teams</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/job-market-outlook">Job Market Outlook</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="https://press.roberthalf.com/">Press Room</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="gradient-content" headline="Trending topics" layout="column"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/salary-hiring-trends">Salary and hiring trends</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/flexible-working">Adaptive working</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/competitive-advantage">Competitive advantage</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/work-life-balance">Work/life balance</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/insights/diversity-equity-inclusion">Diversity and inclusion</a> </rhcl-menu-link> </rhcl-list-base> </rhcl-navigation-item> <rhcl-site-search slot="site-search" search-destination="/us/en/search?param=:1" max-results="3" theme="dark"> <a slot="quick-link" href="/us/en/jobs"><rhcl-typography variant="body2">Browse jobs</rhcl-typography></a> <a slot="quick-link" href="/us/en/hire-talent/form"><rhcl-typography variant="body2">Find your next hire</rhcl-typography></a> <a slot="quick-link" href="/us/en/locations"><rhcl-typography variant="body2">Our locations</rhcl-typography></a> </rhcl-site-search> <rhcl-list slot="account-menu" data-header-menu-endpoint="/graphql/execute.json/roberthalf/headerMenuItems" data-folder-path="/content/dam/roberthalf/content-fragments/en_us/account-menu-links" data-account-menu-config="{"[lux-tokens:lightning-page]":"https://online.roberthalf.com/s","[lux-tokens:visualforce-page]":"https://online.roberthalf.com","[lux-tokens:rhdirect-page]":"https://online.roberthalf.com/mpredirect","[site:url]":"https://www.roberthalf.com/"}" headline=""/> </rhcl-block-navigation> </div> <script type="text/javascript"> function initializeAccountMenu() { var accountMenu = document.querySelector('rhcl-list[slot="account-menu"]'); var userId = getCookie("apex__userid"); var userPermissions = getCookie("apex__psa"); if (!userId || !userPermissions) { if (accountMenu) { accountMenu.remove(); } return; } var userFirstName = getCookie("apex__firstname"); var userLastName = getCookie("apex__lastname"); accountMenu.setAttribute("headline", userFirstName + " " + userLastName); var userPermissionsArray = userPermissions.split(","); var accountMenuLinks = []; var accountMenuLinksAPI = accountMenu.getAttribute("data-header-menu-endpoint"); var accountMenuLinkCFFolderPath = accountMenu.getAttribute("data-folder-path"); var accountMenuConfig = accountMenu.getAttribute("data-account-menu-config"); if (!accountMenuLinkCFFolderPath) { accountMenuLinkCFFolderPath = ""; } var completeAPI = accountMenuLinksAPI + ";cfFolderPath=" + accountMenuLinkCFFolderPath; fetch(completeAPI) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { accountMenuLinks = data.data.headerMenuItemList.items; function getLinkTargetBoolean(linkTarget) { if (linkTarget) { linkTarget = linkTarget.toLowerCase(); } if (linkTarget == "_blank" || linkTarget === "true") { return "true"; } return "false"; } accountMenuLinks.sort(function (a, b) { return a.displayWeight - b.displayWeight }); for (var i = 0; i < accountMenuLinks.length; i++) { var accountMenuLink = accountMenuLinks[i]; if ((accountMenuLink.showToAllLoggedInUsers != null && accountMenuLink.showToAllLoggedInUsers == true) || doPermissionsMatch(accountMenuLink.permissions, userPermissionsArray)) { var menuItemElement = document.createElement("rhcl-menu-link"); var link, mobileLink; menuItemElement.setAttribute("slot", "item"); menuItemElement.setAttribute("label", accountMenuLink.linkDisplayText); menuItemElement.setAttribute("external", getLinkTargetBoolean(accountMenuLink.linkTarget)); if(accountMenuLink.linkUrl){ link = modifyLink(accountMenuLink.linkUrl, accountMenuConfig); }else{ link=""; } if(accountMenuLink.mobileUrlOverride){ mobileLink = modifyLink(accountMenuLink.mobileUrlOverride, accountMenuConfig); }else{ mobileLink=""; } menuItemElement.setAttribute("destination", link); menuItemElement.setAttribute("mobile-destination", mobileLink); accountMenu.append(menuItemElement); } } }) .catch(error => { console.error('There was a problem with the fetching the account menu items:', error); }); } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } function doPermissionsMatch(array1, array2) { if (!array1 || !array2) { return false; } for (let i = 0; i < array2.length; i++) { if (array1.includes(array2[i].trim())) { return true; } } return false; } function modifyLink(link, accountMenuConfig) { if (accountMenuConfig) { var accountMenuConfigJSON = JSON.parse(accountMenuConfig); for (var key in accountMenuConfigJSON) { if (accountMenuConfigJSON.hasOwnProperty(key)) { link = link.replace(key, accountMenuConfigJSON[key]); } } } return link; } initializeAccountMenu(); </script> </div> </div> </div> </div> <div class="root container-fluid cmp-container aem-GridColumn aem-GridColumn--default--12"> <div id="container-4933c6bf9e" class="cmp-container"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="root container-fluid cmp-container rhcl__background--primary rhcl__accent-outline--none aem-GridColumn aem-GridColumn--default--12"> <div class="cq-placeholder" data-emptytext="HFB.005 Hero Form Block Content Cards"></div> <div data-cmp-is="heroformblockcontentcards"> <rhcl-block-hero-form variant="content-cards" headline="We have the talent for your hiring needs" form-headline="Let us know what you’re looking for" background="primary" accent-outline="none"> <span slot="copy"><p>Let our recruiters help you find available, highly skilled candidates for your role.</p> </span> <div slot="form-content"> <div id="experiencefragment-84e20e65c8" class="cmp-experiencefragment cmp-experiencefragment--msjo-v3"> <div id="container-7e8c7aaf45" class="cmp-container"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="root container-fluid cmp-container aem-GridColumn aem-GridColumn--default--12"> <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> <script type="text/javascript"> const payloadDefaults = { actionRequestedOfLp: "", additionalAttribute1: "", additionalAttribute2: "", additionalAttribute3: "", additionalAttribute4: "", additionalAttribute5: "", additionalInfo: payload => { if (payload?.skillsRequested?.length) { return payload.skillsRequested.map(obj => obj.label).join(', ') } }, candidateFeatured1: "", candidateFeatured2: "", candidateFeatured3: "", candidateFeatured4: "", candidateFeatured5: "", candidateFunctionalRole1: "", candidateFunctionalRole2: "", candidateFunctionalRole3: "", candidateFunctionalRole4: "", candidateFunctionalRole5: "", candidateReference1: "", candidateReference2: "", candidateReference3: "", candidateReference4: "", candidateReference5: "", city: "", clientSelectedBranchId: "", clientSelectedBranchName: "", comments: "", companyId: "", companyMatch: "", companyName: "", companyNumber: "", companySize: "", competitor: "", contactMethod: "", contractDuration: (payload) => { if (payload.contractDuration) { return payload.contractDuration; } else { return (payload.positionType === "temp" || payload.employmentType === "temp") ? "30" : ""; } }, country: () => { let country = window?.pageObj?.__extrasettings__?.country || "US"; return country.toUpperCase(); }, description: "", educationLevel: payload => payload.positionType === "perm" ? null : "", email: "", employmentType: (payload) => payload.employmentType || payload.positionType || "perm", experienceDurationMax: "", experienceDurationMin: "", experiencePeriod: "", firstName: "", formName: "NA_US_CA_RH_Staffing_Request", formPage: "hiring_need", formType: "Job Order", formUrl: () => window.location.href, formUrlEncoded: window.encodeURI(window.location.href), gclid: "", googleAnalyticsId: () => { return window.clientId || "" }, httpReferrerUrl: document.referrer || "", httpUserAgentBrowser: window.navigator?.userAgent || "", industry: "", joCnt12Mo: "", joCnt24Mo: "", joCntActive: "", joCntOpen: "", joCntTotal: "", joCntVolume: "", language: window.pageObj?.__extrasettings__?.language || "en", languageLocale: (payload) => {return `${payload.country}-${payload.language}`.toLowerCase()}, lastName: "", leadConsoleLob: "", leadId: () => `rhwebsite_${crypto.randomUUID()}`, leadLatLongDetermined: "", leadLatitude: "", leadLongitude: "", leadSourceCampaign: "", lob: "", location: "", mktAutomationId: (payload) => payload.formName, newsClient: "false", payPeriod: "", payRateCurrency: "", payRateMax: null, payRateMin: null, peopleNumber: (_payload, isLoggedIn) => { if (isLoggedIn) { return getUPO()?.peopleNumber || "" } }, phoneNumber: "", phoneType: "", positionTitle: "", positionType: (payload) => payload.positionType || payload.employmentType || "perm", postalCode: "", reCaptchaAssessmentId: "", reCaptchaScore: "", remoteAddrIp: "", remoteEligible: "No", requiredFieldsValidation: "", rhAnalyticsAddInfo: "", rhInternalTrackingType: (_payload, isLoggedIn) => isLoggedIn ? "LUX" : "RH Website Visitor", rhInternalTrackingValue: (payload) => { if (payload.employmentType) { switch (payload.employmentType) { case "exec": return "executive search"; case "managed services": return "consulting solutions"; case "perm": case "temp": default: return undefined; } } else { return undefined; } }, rhdSourceId: null, routingEmail: "", salutation: "", selfService: "true", servicePreference: "self", sfAccountId: "", sfContactId: (_payload, isLoggedIn) => { if (isLoggedIn) { const searchParams = new URLSearchParams(window.location.search); return searchParams.get("sfContactId") || window["remoteUser"]?.peoplenumber || window.getUPO()?.contactSfID } }, sfJoNumber: null, skillId: null, skillsRequested: null, startDate: (payload) => { if (!payload.startDate) { return undefined; } else { switch (payload.startDate) { case "now": { let date = new Date(); // For temp, set startDate to tomorrow (today's date + 1) date.setTime(date.getTime() + 24 * 60 * 60 * 1000); return date.toISOString().split("T")[0]; } case "month": { let date = new Date(); // For temp, set startDate to tomorrow (today's date + 31) date.setTime(date.getTime() + 30 * 24 * 60 * 60 * 1000); return date.toISOString().split("T")[0]; } case "max": default: { let date = new Date(); // For temp, set startDate to tomorrow (today's date + 500001) date.setTime(date.getTime() + 500000 * 24 * 60 * 60 * 1000); return date.toISOString().split("T")[0]; } } } }, stateProvince: "", strategicAccount: "", subjectLine: "Multistep Job Order", submissionDateTime: () => new Date().toISOString().slice(0, 19).replace("T", " "), tealiumId: () => window.tealiumId || "not set", tou: "", utm_campaign: null, utm_source: null, worksite: (payload) => payload.location !== undefined ? payload.location : "", }; const rhclInputNodes = [ "RHCL-TEXT-FIELD", "RHCL-TEXTAREA", "RHCL-DATEPICKER", "RHCL-TYPEAHEAD", "RHCL-CHECKBOX", "RHCL-CHECKBOX-GROUP", "RHCL-RADIO-GROUP", "RHCL-DROPDOWN", "RHCL-SWITCH", ]; /** * Adds the account check email info to the payload * @param {object} payload submission payload. * @param {string} email user's email * @param {boolean} isLoggedIn from upo * @param {Node} frame frame element */ const addAccountCheckData = async (payload, email, isLoggedIn, frame) => { async function accountEmailCheck(email) { return fetch( window.aemSettings.rh_common.accountCheckEndpoint + email ) .then((res) => res.json().then((data) => { /** * { * "isCandidate": true, #true if SFCC response "emailType" is "candidate" * "isClient": false, #true if SFCC response "emailType" is "client" * "accountCheck": "hasWebAccount", # SFCC response "accountCheck" String value * "hasUser": true # SFCC response "hasUser" boolean value, * "needNewResume": true # if SFCC response "lastResumeDate" is older than 6 month or "lastResumeDate" is null * } **/ return data; }) ) .catch((err) => console.error(err)); } const response = await accountEmailCheck(email); if (response) { const isExistingAccount = response?.hasUser; if (isLoggedIn || isExistingAccount) { payload.actionRequestedOfLp = "create_jo"; } else { payload.actionRequestedOfLp = "create_acc_jo"; } if (frame && isExistingAccount) { const signInDomain = "https://" + window.samlIdpReferrer const language = pageObj?.__extrasettings__?.language?.toLowerCase() ?? "en"; const country = pageObj?.__extrasettings__.country?.toUpperCase() ?? "US"; const locale = language + "_" + country; // existing user flows (authenticated and unauth both) frame.dataset.existingUserRedirectLocation = signInDomain + `/s/jo-details?jobid=[token:jobId]&language=${locale}&a=RH&c=${country}&d=${locale}`; frame.dataset.existingUserRedirect = true; } function parseQuery(queryString) { var query = {}; var pairs = ( queryString[0] === "?" ? queryString.substr(1) : queryString ).split("&"); for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split("="); query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ""); } return query; } const searchParams = new URLSearchParams(window.location.search); if (searchParams.fd) { const fdParams = parseQuery(atob(searchParams.fd)); if (fdParams || searchParams) { ["rhdSourceId", "utm_source", "utm_campaign"].forEach((key) => { // set payload value from query params const value = fdPrefill[key] || searchParams.get(key); if (value) { payload[key] = value; } }); } } if (!payload.rhInternalTrackingType) { if (isLoggedIn) { payload.rhInternalTrackingType = "LUX"; } else if (isExistingAccount) { payload.rhInternalTrackingType = "rh website visitor"; } else if ( payload.utm_source === "rh_promo" && payload.utm_medium === "Email" ) { payload.rhInternalTrackingType = "email campaign"; } else if ( payload.utm_source === "google" && payload.utm_medium === "ppc" ) { payload.rhInternalTrackingType = "ad campaign"; } } } }; const payloadFields = Object.keys(payloadDefaults); const getProgressiveFrameData = (frameElement) => { const payload = {}; if (!frameElement) { console.error("No progressive frame found"); } else { const steps = frameElement.querySelectorAll( 'rhcl-progressive-frame-step:not([page-type="confirmation"])' ); const currentStep = frameElement.currentStepIndex //get step inputs steps.forEach((step, index) => { if (index > currentStep) { // only use form data up to the current frame return } const stepContent = [...step.querySelectorAll("[slot='content'] *")]; // remove all non input or rhcl elements let inputElements = stepContent.filter( (element) => rhclInputNodes.includes(element.nodeName) || element.nodeName === "INPUT" ); // add input element fields into payload inputElements.forEach((el) => { let field; if (el.nodeName === "RHCL-CHECKBOX") { field = { name: el.name, value: el.selected ? true : false }; } else { field = { name: el.name, value: el.value }; } if (field) { if (!field.name || payload[field.name] !== undefined) { console.error( "Input had invalid name or name was already used:", field.name ); } else { if (field.name === "payRateMin" || field.name === "payRateMax") { payload[field.name] = field.value.replace(/[^0-9]/g, ""); } else if (field.name === "phoneNumber"){ // Remove plus signs, parenthesis, dashes spaces and dots payload[field.name] = field.value?.replace(/\D/g,''); } else { payload[field.name] = field.value; } } } }); }); } return payload; }; const addHiddenFieldData = (payload) => { // get hidden fields from page const hiddenFields = document.querySelectorAll(".rhformhiddenfield input"); // add hidden fields to payload if there is matching name in payload hiddenFields.forEach((el) => { if ( el.value !== undefined && payloadFields.includes(el.name) && payload[el.name] === undefined ) { payload[el.name] = el.value; } }); }; const addUpoData = (payload) => { // check upo for values to be included in payload const upo = window.getUPO(); Object.keys(upo).forEach((upoKey) => { if (upoKey === "email") { // skip email prefill into payload // it's causing issues with stale email on the first submission return; } const upoValue = upo[upoKey]; if ( upoValue !== undefined && payloadFields.includes(upoKey) && payload[upoKey] === undefined ) { payload[upoKey] = upoValue; } }); }; const getIp = async () => { return await fetch("https://jsonip.com", { mode: "cors" }) .then(res => res.json()) .then(data => data.ip) .catch(err => { console.error("Problem getting ip:", err.message) }) }; const setPayloadDefaults = (payload, isLoggedIn) => { // add in defaults for fields that aren't in payload already payloadFields.forEach((field) => { if ( payload[field] === undefined || typeof payloadDefaults[field] === "function" ) { // if a field is not set, use values from defaults if (typeof payloadDefaults[field] === "function") { // if the default is a function it should take the current payload // and use that to determine the value for that specific field payload[field] = payloadDefaults[field](payload, isLoggedIn); } else if (payloadDefaults[field] !== undefined) { // if there is any value in the defaults it should be used directly // when there is no value for that field payload[field] = payloadDefaults[field]; } } }); }; const isValidEmailDomain = (email, invalidDomains) => { const emailDomain = email.split("@")[1] return !invalidDomains.split(",").find(domain => domain === emailDomain) } const createPayload = async (frame, isFinalSubmission) => { // console.log("create payload:", frame); const payload = getProgressiveFrameData(frame); const upo = getUPO(); const isLoggedIn = upo?.isLoggedIn || false; let email = payload.email; const currentFrame = frame.children[frame.currentStepIndex] // if the current step has an email input, validate the domain if (currentFrame && currentFrame.querySelector("[name='email']") && !isValidEmailDomain(email, frame.dataset.invalidDomains)) { throw new Error("20_validationFailed_email") } else if (email && frame.dataset.invalidDomains && !isValidEmailDomain(email, frame.dataset.invalidDomains)) { // bad email in upo if (upo) { upo.email = "" window.setUPO(upo) } payload.email = "" email = ""; } if (email) { await addAccountCheckData(payload, email, isLoggedIn, frame); } const skillsEl = frame.querySelector("[name='skills']"); if (skillsEl) { addSkills(skillsEl, payload); } // console.log("payload with frame", { ...payload }); addHiddenFieldData(payload); // console.log("payload with hidden fields", { ...payload }); addUpoData(payload); // console.log("payload with upo", { ...payload }); const ip = await getIp(); if (ip) { payload.remoteAddrIp = ip; } if (!isFinalSubmission) { payload.actionRequestedOfLp = "hold"; } // set job function code on payload const jobTitleField = frame.querySelector('[name="positionTitle"]'); if (jobTitleField?.selectedItemExtra) { payload.jobFunctionCode = jobTitleField.selectedItemExtra } setPayloadDefaults(payload, isLoggedIn); // if there was a leadId set on the frame include it in the payload if (frame.dataset.leadId) { payload.leadId = frame.dataset.leadId; } else { // otherwise use the newly created Id and set it on the frame frame.dataset.leadId = payload.leadId; } return payload; }; const addSkills = (skillsEl, payload) => { // loop through each skill selected const chipEls = skillsEl.shadowRoot.querySelectorAll("rhcl-chip"); [...chipEls].forEach((chipEl) => { // add skill to skillId array if (!payload.skillId || payload.skillId.length === 0) { payload.skillId = []; } payload.skillId.push(chipEl.value); // add skill to skillsRequested if (!payload.skillsRequested) { payload.skillsRequested = [{ name: chipEl.label, Id: chipEl.value }]; } else { payload.skillsRequested.push({ name: chipEl.label, Id: chipEl.value }); } }); // skillId should be formatted as a comma separated string if (payload.skillId && payload.skillId.length) { payload.skillId = payload.skillId.join(","); } }; { window.ready(() => { const resendStatusCodes = [ 500, 502, 503, 504, "50_internalServerError", "53_internalServerError", "51_internalServerError", "52_internalServerError", ]; const dataValidationErrorCodes = [ "20_validationFailed_positionTitle", "20_validationFailed_postalCode", "20_validationFailed_email", ]; /** * Methods for making api calls. */ const sendToResumeFeed = async (data, status) => { let retries = 3; while (retries) { try { const leadsProcessingEndpoint = window.aemSettings?.rh_multistep_job_order ?.leadsProcessingEndpoint || "https://qs05-dr.int-qs-lp.api.roberthalfonline.com/proxy-lead-processing/send"; const response = await axios.post(leadsProcessingEndpoint, data, { headers: { "Content-Type": "application/json", }, }); console.log( `Attempt ${4 - retries}: Response status: ${response.status}` ); if (response?.data?.request_status === "SUCCESS") { let responseCodes = response?.data?.request_message_Key; if (responseCodes) { // successful submission if (responseCodes === "20_success") { // successful form submission event for adobe target (BOBA-5836) const submissionEvent = new Event("formSubmittedSuccessfully"); document.dispatchEvent(submissionEvent); return response.data; } else { // Handle validation errors generated on LP side let errors = []; // This prop should be an array for errors, but just in case if (typeof responseCodes === "string") { responseCodes = [responseCodes]; } responseCodes.forEach((code) => { if (dataValidationErrorCodes.includes(code)) { errors.push(code); } }); if (errors.length > 0) { return { isValidLP: false, errors: errors, }; } } } // return the data anyways return response.data; } else if (resendStatusCodes.includes(response.status)) { retries -= 1; if (retries) { console.log(`Retrying... (attempts remaining: ${retries})`); await new Promise((resolve) => setTimeout(resolve, 1000)); continue; } } break; } catch (error) { console.log( `Attempt ${4 - retries}: Response status: ${error.response.status}` ); if (resendStatusCodes.includes(error.response.status)) { retries -= 1; if (retries) { console.log(`Retrying... (attempts remaining: ${retries})`); await new Promise((resolve) => setTimeout(resolve, 1000)); continue; } } if (status) { throw error.response.data.request_message_key; } break; } } throw new Error("Failed to send data to resume feed."); }; /* handles updating the UPO with new client information after successful submission @param clientPayload - payload used in MSJO submission */ const updateUpoValues = (clientPayload) => { let upo = window.getUPO(); for (const key in clientPayload) { if (key in upo) { if (key === "email") { upo["emailAddress"] = clientPayload[key]; upo["clientEmail"] = clientPayload[key]; } if (key === "phoneNumber") { upo["clientPhoneNumber"] = clientPayload[key]; } if (key === "jobTitle") { upo["customerTitle"] = clientPayload[key]; upo["clientBusinessTitle"] = clientPayload[key]; } if (key === "postalCode") { upo["clientPostalCode"] = clientPayload[key]; } upo[key] = clientPayload[key]; } } window.setUPO(upo); }; const handleSubmissionRedirect = (submissionResponse, frameStep, frame) => { let newLocation = null; if (frame.dataset.existingUserRedirect) { // logged in create jo flow // "request_message": "joId - a1GDR000002XWUj2AO, joNumber - 31000-0012583669" let jobId = submissionResponse?.request_message?.split(",")[0]?.split("-")[1]?.replace(/\s/g, ''); newLocation = frame.dataset.existingUserRedirectLocation.replace("[token:jobId]", jobId || ""); } else if (frameStep?.dataset?.redirectLocation) { // new user flow newLocation = frameStep.dataset.redirectLocation; } else { // no redirect location console.error("No redirect location set"); } if (newLocation) { window.setTimeout(() => { // add timeout so that browser has chance to display response in console window.location = newLocation; }, 50) } } const handleApiError = (frame) => { if (frame?.dataset?.redirectApiError) { window.setTimeout(() => { // add timeout so that browser has chance to display response in console window.location = frame?.dataset?.redirectApiError; }, 50) } } // hide loading spinner function removeLoader() { const backdropStyle = document.querySelector( ".progressive-frame-backdrop#backdrop" ).style; if (backdropStyle) { backdropStyle.display = "none"; } } // display loading spinner function addLoader() { const backdropStyle = document.querySelector( ".progressive-frame-backdrop#backdrop" ).style; if (backdropStyle) { backdropStyle.display = "block"; } } window.progressiveFrameLoaderVisible = isVisible => { isVisible ? addLoader() : removeLoader() } const makeApiCall = async (event) => { const frame = event.detail.frame; const isFinalSubmission = event.detail.isFinalSubmission; const frameStep = event.detail.step; addLoader() if (frame) { try { // only handle submit leads event on progressive frame pages const payload = await createPayload(frame, isFinalSubmission); const response = await sendToResumeFeed(payload); if (response.isValidLP === false) { const errorEvent = new CustomEvent( "rh-progressive-frame-submission-error", { detail: {errors: response.errors, frame} } ); frame.dispatchEvent(errorEvent); return; } updateUpoValues(payload); const responseEvent = new CustomEvent( "rh-progressive-frame-submission-response", { detail: response } ); document.addEventListener("rhcl-progressive-frame-step-submit-clicked", function () { msjoTealiumEvent("contact_info_submit", "contact_info", payload); }); if (!isFinalSubmission) { msjoTealiumEvent("details_submit", "position_details", payload); } if (isFinalSubmission && (response.request_message_Key === '20_success')) { msjoTealiumEvent("job_order_submit", "job_order", payload); }; frame.dispatchEvent(responseEvent); if (isFinalSubmission) { handleSubmissionRedirect(response, frameStep, frame) } } catch (error) { const errorEvent = new CustomEvent( "rh-progressive-frame-submission-error", { detail: {errors: [error.message], frame} } ); frame.dispatchEvent(errorEvent); handleApiError(frame); } finally { removeLoader(); } } }; window.addEventListener("rh-progressive-frame-submission", makeApiCall); // setup typeahead skills suggestion listener const frame = document.querySelector("rhcl-progressive-frame"); if (frame) { const jobTitleField = frame.querySelector('[name="positionTitle"]'); const skillsField = frame.querySelector('[name="skills"]'); if (jobTitleField && skillsField) { // add listener for job title field blur jobTitleField.addEventListener("rhcl-text-field-blur", () => { const jobTitle = jobTitleField.value; let jobFunctionCode = undefined; if (jobTitleField?.selectedItemExtra !== undefined) { jobFunctionCode = jobTitleField.selectedItemExtra; } if (jobTitle) { // store original api location if (!skillsField.dataset.originalSuggestionApi) { skillsField.dataset.originalSuggestionApi = skillsField.typeaheadSuggestionEndpoint; } // replace position token on original suggestion endpoint with job title skillsField.typeaheadSuggestionEndpoint = skillsField.dataset.originalSuggestionApi.replace( ":value", jobTitle ); if (jobFunctionCode !== undefined) { skillsField.typeaheadSuggestionEndpoint = skillsField.typeaheadSuggestionEndpoint.replace( ":code", jobFunctionCode ); } const country = window?.pageObj?.__extrasettings__?.country || "us"; const language = window.pageObj?.__extrasettings__?.language || "EN"; const skillsLocale = country.toLowerCase() + "-" + language.toUpperCase(); skillsField.typeaheadSuggestionEndpoint = skillsField.typeaheadSuggestionEndpoint.replace( ":locale", skillsLocale ); } else if (skillsField.dataset.originalSuggestionApi) { // if there is no job title, use the original suggestion endpoint skillsField.typeaheadSuggestionEndpoint = skillsField.dataset.originalSuggestionApi; } }); } } }); } { const upoData = window.getUPO(); // Default values for all tracking events const baseTrackingObject = (eventName, stepName) => ({ datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: "next", event_version: "public", page_name: "", page_section: "", user_focus: "", user_id_sfc: upoData.contactSfID || "", user_state: upoData.isLoggedIn ? "auth" : "unauth", tealium_event: eventName, form_type: "Job Order", step_name: stepName, }); const getEventKeys = (eventName) => { const eventKeys = { details_submit: ["availability", "job_title", "job_type", "location", "salary_max", "salary_min", "skills",], contact_info_submit: ["form_email", "job_type"], job_order_submit: [ "availability", "event_attr_01", "form_email", "job_title", "job_type", "location", "salary_max", "salary_min", "service_type", "skills",], }; if (eventName === "impression") { return []; } return eventKeys[eventName]; }; const keyMap = { availability: "startDate", job_title: "positionTitle", job_type: "positionType", location: "postalCode", salary_max: "payRateMax", salary_min: "payRateMin", skills: (payload) => payload.skillsRequested?.map((obj) => obj.name)?.join(", "), form_email: (payload) => payload.email || payload.candidateEmail, event_attr_01: () => { const url = new URL(window.location.href); const fromAccountCreate = url.searchParams.get("source") === "direct"; return fromAccountCreate ? "direct" : "blank"; }, service_type: () => "hybrid", //hardcoded }; const msjoTealiumEvent = (eventName, stepName, payload) => { const trackingObject = baseTrackingObject(eventName, stepName); if (eventName === "impression") { rh_datalayer_add(trackingObject, "event"); console.log("tracking event", trackingObject); return; } const eventKeys = getEventKeys(eventName); eventKeys.forEach((key) => { const mapping = keyMap[key]; if (typeof mapping === "function") { // when mapping is a function it may take the payload as an argument trackingObject[key] = mapping(payload); } else { // when mapping is a string it is the key name from the payload trackingObject[key] = payload[mapping]; } }); rh_datalayer_add(trackingObject, "event"); console.log("tracking event", trackingObject); }; window.msjoTealiumEvent = msjoTealiumEvent; window.ready(function () { document.addEventListener( "rhcl-progressive-frame-step-next-clicked", function () { msjoTealiumEvent("impression", "contact_info", {}); } ); const frame = document.querySelector("rhcl-progressive-frame"); if (frame) { msjoTealiumEvent("impression", "position_details", {}); } }); } </script> <script> window.samlIdpReferrer = "online.roberthalf.com"; </script> <div id="progressiveframe-216a91c576" class="cmp-container"> <div id="backdrop" class="d-none progressive-frame-backdrop" style="display: none;"> <div class="loader-div"> <rhcl-loading-spinner label="Please Wait" theme="dark" transparency="partial" style="width: 100%; height: 100%;"/> </div> </div> <rhcl-progressive-frame disable-back-button="false" disable-stepper="false" id="rhcl-progressive-frame--1869830734" data-app-id="root" data-invalid-domains="gmail.com,yahoo.com,hotmail.com,outlook.com,icloud.com,ymail.com,sbcglobal.net,bellsouth.net,jourrapide.com,comcast.net,cox.net,live.com,att.net,telesyncglobal.com,yelesync.co.us,globalcom.com,msn.com,aol.com,yahoo.co.jp,yahoo.com.br,hotmail.co.uk,yahoo.ae,yahoo.at,yahoo.be,yahoo.ca,yahoo.ch,yahoo.cn,yahoo.co,yahoo.co.id,yahoo.co.il,yahoo.co.in,yahoo.co.kr,yahoo.co.nz,yahoo.co.th,yahoo.co.uk,yahoo.co.za,yahoo.com.ar,yahoo.com.au,yahoo.com.cn,yahoo.com.co,yahoo.com.hk,yahoo.com.is,yahoo.com.mx,yahoo.com.my,yahoo.com.ph,yahoo.com.ru,yahoo.com.sg,yahoo.com.tr,yahoo.com.tw,yahoo.com.vn,yahoo.cz,yahoo.de,yahoo.dk,yahoo.es,yahoo.fi,yahoo.fr,yahoo.gr,yahoo.hu,yahoo.ie,yahoo.in,yahoo.it,yahoo.jp,yahoo.net,yahoo.nl,yahoo.no,yahoo.pl,yahoo.pt,yahoo.ro,yahoo.ru,yahoo.se,hotmail.be,hotmail.ca,hotmail.ch,hotmail.co,hotmail.co.il,hotmail.co.jp,hotmail.co.nz,hotmail.co.za,hotmail.com.ar,hotmail.com.au,hotmail.com.br,hotmail.com.mx,hotmail.com.tr,hotmail.de,hotmail.es,hotmail.fi,hotmail.fr,hotmail.it,hotmail.kg,hotmail.kz,hotmail.my,hotmail.nl,hotmail.ro,hotmail.roor,hotmail.ru,gmail.co.za,gmail.com.au,gmail.com.br,gmail.ru" data-redirect-api-error="/us/en/hire-talent/form/need-more-info" prevent-auto-progress> <div class="progressiveframestep containernowrapper container responsivegrid" data-aem-wrapper="true" slot="step"> <rhcl-progressive-frame-step disable-back-button="false" label="Position details" page-type="standard"> <div slot="content"> <script src="https://www.google.com/recaptcha/enterprise.js?render=6LejimkkAAAAAFXPuyq9-cY_Tn0LOdrBWZfprr5D"></script> <style> .form-container{padding:40px 24px} .form-container .form-header{text-align:center;margin-bottom:40px;display:flex;justify-content:center;flex-direction:column;align-items:center} .form-container .form-header .header-text{margin-bottom:26px} .form-container .form-field-set .field-set-header{margin-bottom:24px} .form-container .form-field-set .field-element-row{margin-bottom:8px} .form-container .form-footer{gap:24px;margin-top:28px;justify-content:center} .form-container .form-footer .form-submit-btn{display:flex;justify-content:center;flex-direction:column;align-items:center;gap:24px;#showRedirectStatus{display:none} } .form-container .form-footer .form-submit-btn rhcl-button{width:100%} .form-container .form-footer .form-foot-note{text-align:left} .form-container .form-footer .form-foot-note .rhcl-typography{display:flex;flex-direction:column;gap:16px;padding:0;margin:0 !important;rhcl-typography{text-align:center} } .form-container .form-footer .form-foot-note .rhcl-typography--variant-legal{font-size:12px;letter-spacing:normal;line-height:1.5;font-family:"Noto Sans Regular",OpenSansRegular,"Open Sans Regular","Noto Sans",sans-serif !important} .form-container .form-footer .form-foot-note .rhcl-typography--variant-legal a:hover:after{width:100%;opacity:1} .cmp-experiencefragment .form-container{padding:0} .mobile-app-form .form-foot-note .rhcl-typography p{padding:0;white-space:pre-wrap;margin:0 !important} .mobile-app-form .form-foot-note .rhcl-typography--variant-legal p{font-size:12px;letter-spacing:normal;line-height:1.5;font-family:"Noto Sans Regular",OpenSansRegular,"Open Sans Regular","Noto Sans",sans-serif !important} .mobile-app-form .form-foot-note .rhcl-typography--variant-legal a:hover:after{width:100%;opacity:1} .mobile-app-form .form-div{padding:48px 0 21px 0} #backdrop{position:absolute;top:0;left:0;width:100%;height:100%;z-index:20;background-color:rgba(0,0,0,0.05)} .loader-div{display:flex;justify-content:center;align-items:center;height:100%} @media screen and (min-width:768px){.form-container{padding:48px 40px} .form-container .form-footer .form-submit-btn rhcl-button{width:unset} .form-container .form-footer .form-foot-note{text-align:center} .cmp-experiencefragment .form-container{padding:0} } .cmp-experiencefragment--salary-guide .form-footer{margin-top:0} .grecaptcha-badge{visibility:hidden !important} </style> <script type="text/javascript"> function parseQuery(queryString) { var query = {}; var pairs = ( queryString[0] === "?" ? queryString.substr(1) : queryString ).split("&"); for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split("="); query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ""); } return query; } function phonePrepopFormatter(phone) { const country = window["pageObj"]?.["__extrasettings__"]?.["country"]; if (phone !== null && phone !== undefined) { try { // Remove any non-digit characters let formattedPhone = phone?.replaceAll(/\D/g, ""); if (country === "us" || country === "ca") { // For NA, remove leading 1's and 0's while (/^[01]/.test(formattedPhone.charAt(0))) { formattedPhone = formattedPhone?.substring(1); } } return formattedPhone; } catch (error) { console.error("Failed to format phone:", error); return phone; } } else { return phone; } } function queryParamPrefill() { const handleElementPrefill = (elements, prefillData) => { Object.keys(elements).forEach((name) => { elements[name].forEach((element) => { //handle element auto fill if (element) { switch (element.nodeName) { case "RHCL-DROPDOWN": { const prefillDropdown = (element) => { if (element && element.children && element.children.length) { Array.from(element.children).forEach((child) => { child.selected = prefillData[name] == child.value; }); element.value = prefillData[name]; return true; } }; // try to fill dropdown if (!prefillDropdown(element)) { // if it's not available yet wait for children to be added function onAttributesChanged(_, observer) { // check if child nodes are available const childNodes = Array.from(element.children); for (const child of childNodes) { if (child.value !== undefined) { const prefilled = prefillDropdown(element); if (prefilled) { observer.disconnect(); // disconnect after prefilling } return; } } } // setup attribute mutation observer to fire event with const observer = new MutationObserver(onAttributesChanged); observer.observe(element, { attributes: true }); } break; } case "RHCL-CHECKBOX": { const prefillCheckbox = () => { if (element.interactionRef) { // interactionRef is available, set checked state element.interactionRef.checked = prefillData[name].toLowerCase() == "true"; return true; } }; // if checkbox wasn't available wait for mutation to make it so if (!prefillCheckbox()) { function onMutation(_, observer) { // try to fill checkbox on mutation if (prefillCheckbox()) { // disconnect after prefilling observer.disconnect(); } } // setup attribute mutation observer to fire event with interactionRef const observer = new MutationObserver(onMutation); observer.observe(element, { childList: true, subtree: true, attributes: true, }); } break; } default: element.value = prefillData[name]; if (element.name == "phoneNumber") { let formattedPhone = phonePrepopFormatter(element.value); element.value = formattedPhone; } } } }); }); }; const search = window.location.search; if (search.length && search[0] === "?") { const params = parseQuery(search); //handle form data query param if (params.fd) { const prefillData = parseQuery(atob(params.fd)); const elements = {}; Object.keys(prefillData).forEach((name) => { elements[name] = document.getElementsByName(name); }); const fd = params.fd; if (fd !== null) { const decodedParams = atob(fd); const baseUrl = window.location.origin; let formValue = baseUrl + window.location.pathname + search.replace(/(fd=)[^&$]*/g, decodedParams); if (document.querySelector("#formUrl")) { document.querySelector("#formUrl").value = formValue; handleElementPrefill(elements, prefillData); } } } else { //if no form data query, use all other params and prefill accordingly const elements = {}; Object.keys(params).forEach((name) => { elements[name] = document.getElementsByName(name); }); handleElementPrefill(elements, params); } } } const setRhInternalTracking = () => { // if medium = "Email" tracking = Email Campaign // if medium = "ppc" tracking = Ad Campaign // else tracking = Not found // fd encoded query param has precedence over other query params const trackingTypeElements = document.getElementsByName( "rhInternalTrackingType" ); const trackingValueElements = document.getElementsByName( "rhInternalTrackingValue" ); if (trackingTypeElements.length && window.location.search.length) { const queryParams = parseQuery(window.location.search); const fdParams = queryParams.fd && parseQuery(atob(queryParams.fd)); const medium = (fdParams && fdParams.utm_medium) || queryParams.utm_medium; const campaignValue = (fdParams && fdParams.utm_campaign) || queryParams.utm_campaign || ""; if (medium) { switch (medium.toLowerCase()) { case "paid-social": case "ppc": trackingTypeElements.forEach((el) => (el.value = "Ad Campaign")); break; case "email": trackingTypeElements.forEach((el) => (el.value = "Email Campaign")); break; default: trackingTypeElements.forEach((el) => (el.value = "Not found")); break; } } if (campaignValue) { trackingValueElements.forEach((el) => (el.value = campaignValue)); } } }; /***************************Hidden Field Logic*********************************************/ window.ready(function () { document.querySelectorAll("#backdrop").forEach((ele) => { ele.style.display = "none"; }); if (document.querySelectorAll(".hiddenfield").length > 0) { //get country name from url function getCountryName() { var pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); var country = pagePath.split("/")[1]; country = country != undefined ? country.toUpperCase() : ""; var countryArray = [...document.querySelectorAll("#country")]; countryArray.forEach(function (ele) { ele.value = country; }); } //get language name from url function getLanguageName() { var pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); var language = pagePath.split("/")[2]; var country = pagePath.split("/")[1]; var languageArray = [...document.querySelectorAll("#language")]; languageArray.forEach(function (ele) { ele.value = language + "_" + country; }); } window.addEventListener("rh-client-id-set", function () { getGoogleAnalyticsId(); getTealiumId(); }); //get lob function getLob() { var lob = getURLParameter("lob"); lob = lob != undefined ? lob : ""; var lobArray = [...document.querySelectorAll("#lob")]; lobArray.forEach(function (ele) { ele.value = lob; }); } function getFormUrl() { var formUrlArray = [ ...document.querySelectorAll("#formUrl"), ...document.querySelectorAll("#requestUrl"), ...document.querySelectorAll("#formUrlEncoded"), ]; formUrlArray.forEach(function (ele) { ele.value = new URL(window.location).href; }); } //current date and time in format YYYY-MM-DD HH:MM:SS function currentDateTime() { var d = new Date(); d = d.getFullYear() + "-" + (d.getMonth() + 1 < 10 ? "0" + (d.getMonth() + 1) : d.getMonth() + 1) + "-" + (d.getDate() < 10 ? "0" + d.getDate() : d.getDate()) + " " + (d.getHours() < 10 ? "0" + d.getHours() : d.getHours()) + ":" + (d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes()) + ":" + (d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds()); return d; } function getMiddleInitial() { var middleInitial = currentDateTime(); var middleInitialArray = [...document.querySelectorAll("#middleInitial")]; middleInitialArray.forEach(function (ele) { ele.value = middleInitial; }); } //get ip address function getIpAddress() { fetch("https://jsonip.com/") .then((response) => response.json()) .then((data) => { var ipAddressArray = [ ...document.querySelectorAll("#ipAddress"), ...document.querySelectorAll("#remoteAddrIp"), ]; ipAddressArray.forEach(function (ele) { ele.value = data.ip; }); }) .catch((error) => { console.error("Error fetching IP address:", error); }); } function getGoogleAnalyticsId() { var googleAnalyticsArray = [ ...document.querySelectorAll("#googleAnalyticsId"), ]; googleAnalyticsArray.forEach(function (ele) { ele.value = window.clientId; }); } function getTimeStamp() { var dt = new Date(); var h = dt.getHours(), m = (dt.getMinutes() < 10 ? "0" : "") + dt.getMinutes(); var strDate = dt.getFullYear() + "-" + (dt.getMonth() + 1) + "-" + dt.getDate(); var currentTime = h > 12 ? h - 12 + ":" + m + " PM" : h + ":" + m + " AM"; var currDate = "'" + strDate + "'"; var currentTimeStamp = Date.parse(currDate + currentTime); return currentTimeStamp; } function getSourceId() { var rhdSourceId = getURLParameter("rhdSourceId"); if (rhdSourceId != undefined) { var currentTimeStamp = getTimeStamp(); var rhdSourceIdArray = [...document.querySelectorAll("#rhdSourceId")]; rhdSourceIdArray.forEach(function (ele) { ele.value = rhdSourceId + "-" + currentTimeStamp; }); } else { var formContainer = document.querySelector(".form-container"); var id = formContainer ? formContainer.id : ""; var rhdSourceIdArray = [...document.querySelectorAll("#rhdSourceId")]; rhdSourceIdArray.forEach(function (ele) { ele.value = id + "-" + currentTimeStamp; }); } } function getUtmSource() { var utmsource = getURLParameter("utm_source"); utmsource = utmsource != undefined ? utmsource : ""; var utmSourceArray = [...document.querySelectorAll("#utmSource")]; utmSourceArray.forEach(function (ele) { ele.value = utmsource; }); } function getUtmCampaign() { var campaign = getURLParameter("utm_campaign"); campaign = campaign != undefined ? campaign : ""; var utmCampaignArray = [...document.querySelectorAll("#utmCampaign")]; utmCampaignArray.forEach(function (ele) { ele.value = campaign; }); } function getSfJoNumber() { var sfJoNumber = getURLParameter("sfJoNumber"); sfJoNumber = sfJoNumber != undefined ? sfJoNumber : ""; var sfJoNumberArray = [...document.querySelectorAll("#sfJoNumber")]; sfJoNumberArray.forEach(function (ele) { ele.value = sfJoNumber; }); } function getTealiumId() { var tealiumIdArray = [...document.querySelectorAll("#tealiumId")]; tealiumIdArray.forEach(function (ele) { ele.value = window?.tealiumId; }); } function getGclid() { var searchParams = parseQuery(window.location.search); var gclidVal = searchParams?.gclid ? searchParams.gclid : "not defined"; var gclidArray = [...document.querySelectorAll("#gclid")]; gclidArray.forEach(function (ele) { ele.value = gclidVal; }); } function getSfContactId() { var sfContactId = getURLParameter("sfContactId"); sfContactId = sfContactId != undefined ? sfContactId : ""; var sfContactIdArray = [...document.querySelectorAll("#sfContactId")]; sfContactIdArray.forEach(function (ele) { ele.value = sfContactId; }); } function getURLParameter(sParam) { var sPageURL = new URL(window.location); sPageURL = sPageURL.search.substring(1); var sURLVariables = sPageURL.split("&"); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split("="); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } function updatePageHeading() { var replaceFields = [ { replace: "{positionTitle}", queryParam: "positionTitle" }, { replace: "{city}", queryParam: "city" }, { replace: "{country}", queryParam: "country" }, { replace: "{location}", queryParam: "location" }, { replace: "{jobtitle}", queryParam: "jobtitle" }, ]; const queryParams = parseQuery(window.location.search); replaceFields.forEach((replacement) => { const value = queryParams[replacement.queryParam] || null; const hfbHeadlineElement = document.querySelector( "rhcl-block-hero-form" ); const hfbHeadline = hfbHeadlineElement ? encodeURIComponent(hfbHeadlineElement.getAttribute("headline")) : ""; if (value !== null && hfbHeadline.indexOf(replacement.replace) > -1) { hfbHeadline.replace(replacement.replace, value); document .querySelector("rhcl-block-hero-form") .setAttribute("headline", sentence.replaceAll("%20", " ")); } }); } getCountryName(); getLanguageName(); getLob(); getFormUrl(); getMiddleInitial(); getIpAddress(); getGoogleAnalyticsId(); getSourceId(); getUtmSource(); getUtmCampaign(); getSfJoNumber(); getTealiumId(); getGclid(); getSfContactId(); } if (document.querySelectorAll("rhcl-block-hero-form").length > 0) { updatePageHeading(); } // use fd prefill after to give precedence to fd querystrings setRhInternalTracking(); }); window.addEventListener("rhcl-initialized", () => { queryParamPrefill(); }); queryParamPrefill(); (function() { var test = document.querySelectorAll("#recaptcha").length; var recaptchaFlag = 0; const firstRhclButton = document.querySelector("rhcl-button"); const recaptchaFailMessage = firstRhclButton && firstRhclButton?.getAttribute("data-recaptcha-message"); const recaptchaEndpoint = aemSettings?.rh_common?.recaptchaEndpoint; const bypassToken = document.getElementById("bypassToken"); let formActionUrlIterable = new Map(); let bypassPerimeter = ""; if (bypassToken != null) { bypassPerimeter = bypassToken.getAttribute("value"); } //Request types and associated fields let requestData; var candidateWorkHistory = { recaptchaEnabled: "", invisibleRecaptchaToken: "", subscriberKey: "", }; let jobAlertRequestObject = { candidateEmailAddress: "", locale: "", keywords: "", keywordsNoSpaces: "", subscriptionSource: "rhWebsite", countryCode: "", searchResultsUrl: "", subscriptionSourceUrl: "", postedWithin: "", jobType: "", empType: "", cityId: "", cityTxt: "", jobAlertsSubscriptionId: "", lobName: "", location: "", locationNoSpaces: "", googleAnalyticsClientId: "", emailFrequency: "W", jobOrderRecommendationsCount: "5", insrtDttmHist: "", subscriptionType: "Manual", status: "A", }; var leadApiRequestObject = { recaptchaEnabled: "", invisibleRecaptchaToken: "", servicePreference: "", startDate: "", languageLocale: "", rhAnalyticsAddInfo: "", routingEmail: "", candidateReference1: "", candidateFunctionalRole1: "", candidateReference2: "", candidateFunctionalRole2: "", candidateReference3: "", candidateFunctionalRole3: "", candidateReference4: "", candidateFunctionalRole4: "", candidateReference5: "", candidateFunctionalRole5: "", additionalAttribute1: "", additionalAttribute2: "", additionalAttribute3: "", additionalAttribute4: "", additionalAttribute5: "", skillsRequested: "", experienceDurationMin: "", experienceDurationMax: "", experiencePeriod: "", educationLevel: "", payRateMin: "", payRateMax: "", payPeriod: "", payRateCurrency: "", additionalInfo: "", actionRequestedOfLp: "SUBMIT", rhInternalTrackingType: "", }; var newsApiObject = { recaptchaEnabled: "", invisibleRecaptchaToken: "", }; function scrollToTopOfForm() { const formContainer = document.querySelector(".form-container"); if (formContainer) { const topEl = formContainer .closest("rhcl-block-hero-form") ?.shadowRoot?.querySelector(".rhcl-block-hero-form__form"); const topOfForm = topEl?.getBoundingClientRect()?.top; const defaultHeaderHeight = 78; const headerHeight = parseInt( getComputedStyle(formContainer).getPropertyValue( "--rhcl-main-navigation-height" ), 10 ) || defaultHeaderHeight; if (top !== undefined) { setTimeout(() => { window.scrollTo({ top: topOfForm + window.scrollY - headerHeight, behavior: "smooth", }); }, 500); } } } function getURLParameters() { const urlSearchParams = new URLSearchParams(window.location.search); const params = Object.fromEntries(urlSearchParams.entries()); return params; } function getByPassStatus(params) { var arrayLength = params.length; for (var i = 0; i < arrayLength; i++) { if (params[i] === bypassPerimeter) { return 0; } } return 1; } function setKeyValueInUPO(key, unifiedProfileObject, value) { //set a particular key value in UPO unifiedProfileObject[key] = value; return unifiedProfileObject; } function saveGatingPropertyInUPO() { if (localStorage.getItem("unifiedProfileObject") != null) { var unifiedProfileObject = window.getUPO(); const gatingProperties = document.querySelector(".gating-properties"); if (gatingProperties != null) { var gatingProperty = gatingProperties.getAttribute("gatingproperty") != undefined ? gatingProperties.getAttribute("gatingproperty") : "sgGatingFormSubmitted"; unifiedProfileObject = setKeyValueInUPO( gatingProperty, unifiedProfileObject, window.salaryGuideGatingProperties.key ); window.setUPO(unifiedProfileObject); } } window.localStorage.setItem( "salaryGuideGatingKey", window.salaryGuideGatingProperties.key ); } var businessUnit = { us: "na", ca: "na", au: "iz_apac_sam", br: "iz_apac_sam", cl: "iz_apac_sam", cn: "iz_apac_sam", hk: "iz_apac_sam", jp: "iz_apac_sam", nz: "iz_apac_sam", sg: "iz_apac_sam", be: "iz_eu", ch: "iz_eu", de: "iz_eu", fr: "iz_eu", nl: "iz_eu", uk: "iz_eu", }; const removeTags = (str) => { if (str === null || str === "") { return false; } else { str = str.toString(); } // Regular expression to identify HTML tags in the input string. Replacing the identified HTML tag with a null string. str = str.replace(/(<([^>]+)>)/gi, ""); // Regular expression to identify enter in the input string. Replacing the identified enter with a null string. return (str = str.replace(/\r?\n|\r/g, "")); }; //Success handling for form submit redirect function handleShowRedirectStatusSuccess(form, thisInstance) { form.nextElementSibling.style.display = "none"; let thankYouPage = thisInstance .getAttribute("destination") .replace("/content/roberthalf", "") .replace(".html", ""); const redirectionUrl = window.localStorage.getItem("redirectionUrl"); if ( thankYouPage !== undefined && thankYouPage !== "" && thankYouPage != null ) { if (redirectionUrl) { if (thankYouPage.includes("html")) { thankYouPage = thankYouPage.split(".")[0]; thankYouPage += redirectionUrl + ".html"; } else { thankYouPage += redirectionUrl; } localStorage.removeItem("redirectionUrl"); } const timeout = thisInstance.getAttribute("data-redirect-delay") || 0; const target = thisInstance.getAttribute("data-redirect-target") || "_self"; if (target === "_self") { setTimeout(()=> { window.location.replace(thankYouPage); }, timeout); } else { window.open(thankYouPage, "_blank"); } } } //Success handling for email modal function handleEmailModalSuccess(form) { form.nextElementSibling.style.display = "none"; document.querySelector("#email-model").removeAttribute("show-modal"); if (document.querySelector("#thankyou-modal") !== null) { document .querySelector("#thankyou-modal") .setAttribute("show-modal", ""); let thankUName, thankUEmail; if (localStorage.getItem("unifiedProfileObject") != null) { thankUName = window.getUPO().firstName; thankUEmail = window.getUPO().emailAddress ? window.getUPO().emailAddress : window.getUPO().email; } let thankYouHeading = document.querySelector( "#thankyou-modal rhcl-heading" ); let thankYouEmail = document.querySelector( "#thankyou-modal rhcl-typography" ); if (thankYouHeading != null) { let thankYouName = document .querySelector("#thankyou-modal rhcl-heading") .getAttribute("data-attribute-heading"); thankYouName = thankYouName.replace("<>", thankUName); document.querySelector( "#thankyou-modal rhcl-heading" ).textContent = thankYouName; } if (thankYouEmail != null) { let thankYouEmail = document .querySelector("#thankyou-modal rhcl-typography") .getAttribute("data-attribute-disclaimer"); thankYouEmail = thankYouEmail.replace("<>", thankUEmail); document.querySelector( "#thankyou-modal rhcl-typography" ).textContent = thankYouEmail; } } } //Success handling for form submit popup message function handlePopupStatusSuccess(form, response){ form.nextElementSibling.style.display = "none"; const alertEl = document.querySelector( ".form-container rhcl-alert" ); const formContainer = document.querySelector(".form-container"); const formContentEls = document.querySelectorAll( '[slot="form-content"]' ); if (alertEl) { alertEl.style.display = "none"; } if (formContainer) { formContainer.style.display = "none"; } formContentEls.forEach((el) => { el.style.display = "flex"; el.style.justifyContent = "center"; el.style.flexWrap = "wrap"; }); let successMsg = response.hasOwnProperty("request_message") ? response.request_message : "The action was processed successfully."; successMsg = (document.querySelector("#showPopupStatus") && document.querySelector("#showPopupStatus").getAttribute("data-copy")) ? document .querySelector("#showPopupStatus") .getAttribute("data-copy") : successMsg; successMsg = (document.querySelector("#showRedirectAndPopupStatus") && document.querySelector("#showRedirectAndPopupStatus").getAttribute("data-copy")) ? document .querySelector("#showRedirectAndPopupStatus") .getAttribute("data-copy") : successMsg; successMsg = removeTags(successMsg); document .querySelectorAll('[slot="form-content"]') .forEach(function (element) { element.insertAdjacentHTML( "afterbegin", `<rhcl-typography tag='p' variant='body1'>${successMsg}</rhcl-typography>` ); }); scrollToTopOfForm(); } function ajaxCall(input, thisInstance, form) { let successRedirectStatus = false; let successPopupStatus = false; let successEmailModalStatus = false; const handleDataValidationFailed = (messageKey, message, form) => { if ( messageKey === "20_validationFailed_invisibleRecaptchaToken" || messageKey === "20_validationFailed_invisibleRecaptchaScore" ) { form.nextElementSibling.style.display = "none"; showInteractiveReCaptcha(); } else if ( messageKey === "20_validationFailed_interactiveRecaptchaToken" || messageKey === "20_validationFailed_interativeRecaptchaToken" ) { form.nextElementSibling.style.display = "none"; displayCustomAlert(message); } else if ( messageKey === "20_validationFailed_interactiveRecaptchaToken" || messageKey === "20_validationFailed_interativeRecaptchaToken" ) { form.nextElementSibling.style.display = "none"; displayCustomAlert(message); } else { cleanUpRecaptcha(); } }; const handleFormTypeAnalytics = () => { const formTypeVal = document.querySelector( ".rhformhiddenfield input[name=formType]" ); const projectTypeVal = document.querySelector( ".rhformhiddenfield input[name=projectType]" ); if (formTypeVal && requestData?.formType && formTypeVal.value !== requestData.formType) { formTypeVal.value = requestData.formType; } let analyticObj; //Single step job order form if (formTypeVal && formTypeVal.value === "job-order") { var industry = document.querySelector( "form rhcl-text-field[name=industry]" )?.value; analyticObj = { tealium_event: "job_order_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, indicator_remote: !!document .querySelector("rhcl-checkbox") ?.hasAttribute("selected"), industry: industry ? industry : "", job_id: document.querySelector("#sfJoNumber") ? document.querySelector("#sfJoNumber").getAttribute("value") : "", job_type: window.getUPO().employmentType, job_title: window.getUPO().positionTitle, lob: document.querySelector("#lob") ? document.querySelector("#lob").getAttribute("value") : "", location: window.getUPO().postalCode, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //Executive Search form if (formTypeVal && formTypeVal.value === "executive-search") { analyticObj = { tealium_event: "job_order_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), event_version: "executive search", form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, job_title: window.getUPO().positionTitle, location: window.getUPO().postalCode, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //Newsletter subscription form if (formTypeVal && formTypeVal.value === "newsletter-subscription") { analyticObj = { tealium_event: "newsletter_subscription_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //Salary guide form if (formTypeVal && formTypeVal.value === "salary-guide") { let userType = ""; let checkBoxVal = document.querySelector("form rhcl-radio-group") ? document.querySelector("form rhcl-radio-group").value : ""; if (checkBoxVal === "yes") { userType = "client"; } else if (checkBoxVal === "no") { userType = "candidate"; } analyticObj = { tealium_event: "salary_guide_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, user_type: userType, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //webmaster feedback form if (formTypeVal && formTypeVal.value === "webmaster-feedback") { analyticObj = { tealium_event: "feedback_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_type: formTypeVal.value, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); console.log(analyticObj, "event"); } //client visit form if (formTypeVal && formTypeVal.value === "client-visit") { analyticObj = { tealium_event: "client_visit_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), event_version: projectTypeVal.value, form_type: formTypeVal.value, form_name: formTypeVal.name, form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, page_name: "", page_section: "", user_focus: "", user_state: window.getUPO().isLoggedIn ? "auth" : "unauth", }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //gated form if (formTypeVal && formTypeVal.value === "gated") { let visitorTypeValue = requestData.visitorType || document.querySelector( "form rhcl-radio-group[name='visitorType']" )?.value || ""; if ( visitorTypeValue === "" && document.getElementsByName("visitorType").length ) { visitorTypeValue = document.getElementsByName("visitorType")[0]?.value; } analyticObj = { tealium_event: "gated_submit", datalayer_version: 2, event_attr_01: visitorTypeValue, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), event_version: projectTypeVal.value, form_type: formTypeVal.value, form_name: formTypeVal.name, form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, page_name: "", page_section: "", user_focus: "", user_state: window.getUPO().isLoggedIn ? "auth" : "unauth", }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); console.log(analyticObj, "event"); } //job order forms if ( formTypeVal && (formTypeVal.value === "job-order-no-rhd" || formTypeVal.value === "job-order-one-click") ) { analyticObj = { tealium_event: "job_order_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_type: formTypeVal.value, }; const hasEmail = Array.from( document.querySelectorAll("form rhcl-text-field") ).filter((ele) => { return ele.type === "email"; }); if (hasEmail.length) analyticObj["form_email"] = hasEmail[0].value; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } if ( formTypeVal && (formTypeVal.value === "candidate-referral" || formTypeVal.value === "email-us" || formTypeVal.value === "job-order-no-rhd" || formTypeVal.value === "job-order-one-click" || formTypeVal.value === "mobile-app-download" || formTypeVal.value === "candidate-work-history" || formTypeVal.value === "contact-us-aws" || formTypeVal.value === "contact-us") ) { analyticObj = { tealium_event: "form_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_type: formTypeVal.value, }; const hasEmail = Array.from( document.querySelectorAll("form rhcl-text-field") ).filter((ele) => { return ele.type === "email"; }); if (hasEmail.length) analyticObj["form_email"] = hasEmail[0].value; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } if (document.querySelector(".salary-guide") !== null) { form.nextElementSibling.style.display = "none"; saveGatingPropertyInUPO(); } } const displayCustomAlert = (message) => { const alertElement = document.querySelector(".form-container rhcl-alert:first"); alertElement.setAttribute("copy", message); alertElement.style.display = "block"; setTimeout(() => { const formContainer = document.querySelector(".form-container"); window.scrollTo({ top: formContainer.getBoundingClientRect() + formContainer.ownerDocument.defaultView.scrollY, behavior: "smooth", }); }, 500); }; const displayErrorMessage = (status, form) => { form.nextElementSibling.style.display = "none"; const alertEl = document.querySelector( ".form-container rhcl-alert[data-status='" + status + "']" ); if (alertEl) { alertEl.style.display = "block"; } scrollToTopOfForm(); } const displayDynamicErrorMessage = (fieldName) => { const fieldEl = document.querySelector(`.form-container *[name='${fieldName}']`); let errorMessage = fieldEl?.getAttribute("error-message-lp"); if (errorMessage && errorMessage.includes(fieldName)) { errorMessage = errorMessage.replace( `{${fieldName}}`, leadApiRequestObject[fieldName] ); } if (errorMessage && fieldEl) { fieldEl.customErrorMessage = errorMessage; fieldEl.customInvalid = true; } } const handleSuccessResponse = (response) => { // successful form submission event for adobe target (BOBA-5836) if (response?.requestMessageKey === "20_success" && !response?.request_message?.endsWith("#")) { const submissionEvent = new Event("formSubmittedSuccessfully"); document.dispatchEvent(submissionEvent); } if (successPopupStatus) handlePopupStatusSuccess(form, response); if (successEmailModalStatus) handleEmailModalSuccess(form); if (successRedirectStatus) handleShowRedirectStatusSuccess(form, thisInstance); } const handleErrorResponse = (response) => { const { status, request_message_Key } = response; if ([500, 502, 503, 504, "error"].includes(status)) { displayErrorMessage(status, form); return; } if (request_message_Key) { form.nextElementSibling.style.display = "none"; if (request_message_Key.length > 0) { if (request_message_Key.includes("20_validationFailed_postalCode")) { displayDynamicErrorMessage("postalCode"); } if (request_message_Key.includes("20_validationFailed_positionTitle")) { displayDynamicErrorMessage("positionTitle"); } scrollToTopOfForm(); } } handleDataValidationFailed(response, request_message_Key, form); } const cleanUpRecaptcha = () => { const recaptchaContainer = document.getElementById("grecaptcha-interactive"); if (recaptchaContainer) recaptchaContainer.remove(); recaptchaFlag = 0; delete leadApiRequestObject?.interactiveRecaptchaToken; delete candidateWorkHistory?.interactiveRecaptchaToken; delete newsApiObject?.interactiveRecaptchaToken; }; //Run POST fetch for all form requests const handleAllFetches = () => { const fetchWithRetry = (url, requestData, type, retries = 3) => { return fetch(url, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(requestData), }) .then((response) => { if (response.ok) { return response.json().then((data) => ({response, status: response.status, data, type})); } else if (retries > 0) { return fetchWithRetry(url, requestData, type, retries - 1); } else { console.log(`Max retries for the following submission endpoint: ${url}`); return { status: "error", data: null, error: "Max retries reached" }; } }) .catch((error) => { console.error(`Fetch error for ${url}:`, error); return { status: "error", data: null, error }; }); }; //Create each fetch request with specific payload for each request type (leads, nonleads,jobalerts) const fetchRequests = formActionUrlIterable.map(([type, url]) => { requestData = createRequestPayload(input, thisInstance, type); return fetchWithRetry(url, requestData, type); }); //Collect responses and handle responses for the POST request(s). Promise.all(fetchRequests) .then((responses) => { let fetchFailList = []; let fetchSuccessList = []; responses.forEach(({ response, status, data , type}) => { const requestMessageKey = data.request_message_key || data.request_message_Key; const requestMessage = data.request_message; if ((status === 200 || status === 202) && requestMessageKey === "20_success") { // Handle success paths if (document.querySelector("#showRedirectStatus")) { successRedirectStatus = true; } if (document.querySelector("#showRedirectAndPopupStatus")) { successRedirectStatus = true; successPopupStatus = true; } if (document.querySelector("#showPopupStatus")) { successPopupStatus = true; } if (document.querySelector("#email-model")) { successEmailModalStatus = true; } fetchSuccessList.push( { "type": type, "response": data } ) } else { fetchFailList.push( { "type": type, "response": data } ) handleDataValidationFailed( requestMessageKey, requestMessage, form); } }); if (fetchFailList.length > 0) { const hasFailMarketing = fetchFailList.some(item => item.type === "nonLeads"); const hasSuccessLeads = fetchSuccessList.some(item => item.type === "leads"); //In scenario where leads AND nonleads are called we set success if leads is the only successful call if (hasFailMarketing && hasSuccessLeads) { if (typeof fetchSuccessList[0].response.request_message_Key !== "string" && fetchSuccessList[0].response.request_message_Key !== "20_success" ) { return; } handleSuccessResponse(fetchSuccessList[0].response); } else { handleErrorResponse(fetchFailList[0].response, form); } } else { // Handle each success scenarios after all responses are processed handleSuccessResponse(fetchSuccessList[0].response); } handleFormTypeAnalytics(); }) .catch((error) => { console.error("Error handling fetch requests:", error); displayErrorMessage("error", form); }); }; handleAllFetches(); } window.ready(function () { document .querySelectorAll(".form-submit-btn rhcl-button") .forEach(function (el) { el.addEventListener("click", function (e) { e.preventDefault(); recaptchaStatus(); getLeadId(); setTimeout(getSubmissionDate, 2000); let thisInstance = this; let form = this.closest("form"); if (!form.closest(".salary-guide")) { localStorage.removeItem("redirectionUrl"); } var inputElements = form.querySelectorAll("[rhcl-input]"); var dateElements = form.querySelectorAll("rhcl-datepicker"); let validateFieldArray = [...inputElements, ...dateElements]; setFormActionUrls(); validateForm(validateFieldArray, thisInstance, form); if (document.querySelectorAll(".salary-guide").length > 0) { updateHiddenFields(); } }); }); document.querySelectorAll(".form-btn rhcl-button").forEach(function (el) { el.addEventListener("click", function (e) { e.preventDefault(); const thisInstance = this; var form = document.querySelector(".form-btn") ? document.querySelector(".form-btn").closest("form") : null; var inputElements = form ? form.querySelectorAll("[rhcl-input]") : []; let validateFieldArray = Array.from(inputElements); setFormActionUrls(); validateForm(validateFieldArray, thisInstance, form); recaptchaStatus(); }); }); }); function getPostalCodeInForm() { return document.querySelector("rhcl-text-field[name='postalCode']"); } function setFormActionUrls() { const formActionUrls = document.querySelector(".form-btn") ? document.querySelector(".form-btn").closest("form").getAttribute("data-attribute-endpoints") : document .querySelector(".form-submit-btn") .closest("form") .getAttribute("data-attribute-endpoints"); const formActionUrlMap = JSON.parse(formActionUrls); formActionUrlIterable = Object.entries(formActionUrlMap); } function isCountryUS() { var country = document.getElementById("country"); return country && country.hasAttribute("value") && country.value === "US"; } function isPostalCodeInvalidForUS(value) { return ( value.match(/^(82[0-9]{3}|83[0-3][0-9]{2}|8341[0-4])$/) || value.match( /^(995[0-9]{2}|996[0-9]{2}|997[0-9]{2}|998[0-9]{2}|999[0-4][0-9]|99950)$/ ) || value.match( /^(24[7-9][0-9]{2}|25[0-9]{3}|26[0-7][0-9]{2}|268[0-7][0-9]|2688[0-6])$/ ) ); } function getPostalCodeErrorValidity() { var postalCodeField = getPostalCodeInForm(); var value = postalCodeField.value; if (!postalCode || !isCountryUS()) { return false; } const isInvalid = isPostalCodeInvalidForUS(value); var initialMessage = postalCodeField.getAttribute("custom-error-message"); if (isInvalid) { initialMessage = `Robert Half cannot support staffing needs in ${value} at this time.`; postalCodeField.setAttribute("custom-invalid", ""); postalCodeField.setAttribute("custom-error-message", initialMessage); } else { postalCodeField.removeAttribute("custom-invalid"); postalCodeField.removeAttribute("custom-error-message"); } return isInvalid; } var postalCode = getPostalCodeInForm(); if (postalCode) { postalCode.addEventListener("rhcl-text-field-blur", function (e) { if (isCountryUS()) { let isValid = true; const promises = []; postalCode.removeAttribute("custom-invalid"); postalCode.customInvalid = null; promises.push(postalCode.validate()); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { getPostalCodeErrorValidity(); } }); } }); if ( getURLParameter("postalCode") != "" || getURLParameter("postalCode") != null || getURLParameter("postalCode") != undefined ) { var postalCodecount = 0; document .querySelector(".form-container rhcl-text-field[name='postalCode']") .addEventListener("rhcl-text-field-changed", function (e) { var patternId = document.querySelector("#rhFormTextField"); var pattern = ""; var patternMessage = ""; if (patternId) { pattern = patternId.hasAttribute("data-pattern") ? patternId.getAttribute("data-pattern") : ""; patternMessage = patternId.hasAttribute("data-errorMessage") ? patternId.getAttribute("data-errorMessage") : ""; } let isValid = true; const promises = []; document .querySelector("rhcl-text-field[name='postalCode']") .removeAttribute("custom-invalid"); document.querySelector( "rhcl-text-field[name='postalCode']" ).customInvalid = null; promises.push( document .querySelector("rhcl-text-field[name='postalCode']") .validate() ); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { postalCodecount += 1; if (postalCodecount < 2 && this.value) { const value = this.value; if (pattern && value.match(pattern) === null) { this.setAttribute("custom-invalid", ""); } else { this.removeAttribute("custom-invalid"); } this.setAttribute("custom-error-message", patternMessage); } } }); }); } } function getEmailField() { return document.querySelector('[id^="rhcl-text-field"][type="email"]'); } if ( document.querySelector("rhcl-datepicker[name='startDate']") && document.querySelector("rhcl-datepicker[name='endDate']") ) { document .querySelector("rhcl-datepicker[name='endDate']") .addEventListener("rhcl-calendar-change", (e) => { let isValid = true; const promises = []; document .querySelector("rhcl-datepicker[name='endDate']") .removeAttribute("custom-invalid"); document.querySelector("rhcl-datepicker[name='endDate']").customInvalid = null; document .querySelector("rhcl-datepicker[name='endDate']") .labelRef.removeAttribute("custom-invalid"); promises.push( document.querySelector("rhcl-datepicker[name='endDate']").validate() ); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { const formName = document.querySelector( "input[name='formName']" ).value; if (formName && formName.includes("candidate_work_history")) { const startDate = document.querySelector( "rhcl-datepicker[name='startDate']" ); const endDate = document.querySelector( "rhcl-datepicker[name='endDate']" ); const errorMsg = endDate.hasAttribute("data-custom-error-message") ? endDate.getAttribute("data-custom-error-message") : ""; var initialMessage = endDate.getAttribute("custom-error-message"); endDate.removeAttribute("custom-invalid"); endDate.labelRef.removeAttribute("custom-invalid"); var flag = 0; if (new Date(startDate.value) >= new Date(endDate.value)) { flag = 1; if (errorMsg) { initialMessage = errorMsg; } else { initialMessage = "Start Date can not be greater than End Date"; } } if (flag === 1) { endDate.setAttribute("custom-invalid", ""); endDate.labelRef.setAttribute("custom-invalid", ""); } else { endDate.removeAttribute("custom-invalid"); endDate.labelRef.removeAttribute("custom-invalid"); } endDate.setAttribute("custom-error-message", initialMessage); } } }); }); document .querySelector("rhcl-datepicker[name='startDate']") .addEventListener("rhcl-calendar-change", (e) => { let isValid = true; const promises = []; if (document.querySelector("rhcl-datepicker[name='endDate']").value) { document .querySelector("rhcl-datepicker[name='endDate']") .removeAttribute("custom-invalid"); document.querySelector( "rhcl-datepicker[name='endDate']" ).customInvalid = null; document .querySelector("rhcl-datepicker[name='endDate']") .labelRef.removeAttribute("custom-invalid"); promises.push( document.querySelector("rhcl-datepicker[name='endDate']").validate() ); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { var startDate = document.querySelector( "rhcl-datepicker[name='startDate']" ); var endDate = document.querySelector( "rhcl-datepicker[name='endDate']" ); const errorMsg = endDate.hasAttribute("data-custom-error-message") ? endDate.getAttribute("data-custom-error-message") : ""; var initialMessage = endDate.getAttribute("custom-error-message"); endDate.removeAttribute("custome-invalid"); endDate.labelRef.setAttribute("custom-invalid", ""); var flag = 0; if ( endDate.value && new Date(startDate.value) > new Date(endDate.value) ) { flag = 1; if (errorMsg) { initialMessage = errorMsg; } else { initialMessage = "Start Date can not be greater than End Date"; } } if (flag === 1) { endDate.setAttribute("custom-invalid", ""); endDate.labelRef.setAttribute("custom-invalid", ""); } else { endDate.removeAttribute("custom-invalid"); endDate.labelRef.removeAttribute("custom-invalid"); } endDate.setAttribute("custom-error-message", initialMessage); } }); } }); } if (document.querySelector("rhcl-checkbox[name='currentEmployer']")) { document .querySelector("rhcl-checkbox[name='currentEmployer']") .addEventListener("rhcl-checkbox-changed", () => { const formName = document.querySelector("input[name='formName']").value; if (formName && formName.includes("candidate_work_history")) { const currEmp = document.querySelector( "rhcl-checkbox[name='currentEmployer']" ).selected; const endDate = document.querySelector( "rhcl-datepicker[name='endDate']" ); if (currEmp && endDate) { endDate.setAttribute("disabled", ""); endDate.setAttribute("date", ""); endDate.style.pointerEvents = "none"; endDate.style.opacity = 0.6; endDate.hasAttribute("custom-invalid") ? endDate.removeAttribute("custom-invalid") : ""; } else { endDate.removeAttribute("disabled"); endDate.style.pointerEvents = "unset"; endDate.style.opacity = 1; } } }); } function updateHiddenFields() { var pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); var country = pagePath.split("/")[1]; var language = pagePath.split("/")[2]; if ( businessUnit.hasOwnProperty(country) && country != undefined && language != undefined ) { var formName = "form_" + businessUnit[country] + "_" + country + "_" + language + "_salary_guide_gating"; if (document.querySelector("input[name='formName']") != null) { document.querySelector("input[name='formName']").value = formName; } if (document.querySelector("input[name='language']") != null) { document.querySelector("input[name='language']").value = language.toUpperCase(); } if (document.querySelector("input[name='countryCode']") != null) { document.querySelector("input[name='countryCode']").value = country.toUpperCase(); } if (document.querySelector("input[name='salaryGuideYear']") != null) { document.querySelector("input[name='salaryGuideYear']").value = new Date().getFullYear(); } } } function createRequestPayload(input, thisInstance, endpointType) { let unifiedProfileObject; var hiddenInput = thisInstance .closest("form") .querySelectorAll("input[type=hidden]"); var dates = document.querySelectorAll("form rhcl-datepicker"); if (localStorage.getItem("unifiedProfileObject") != null) { unifiedProfileObject = window.getUPO(); } const inputArray = [...input, ...hiddenInput, ...dates]; if ( endpointType === "jobAlerts" ) { let inputValues = { searchTerms: "", emailAddress: "", location: "", country: "", language: "", }; for (const element in inputArray) { inputValues = retrieveJobAlertsInputFields( inputArray[element], inputValues ); } updateJobAlertDetails(inputValues); return jobAlertRequestObject; } else { for (const element in inputArray) { if ( inputArray[element].tagName.toLocaleLowerCase() != "rhcl-checkbox" && inputArray[element].tagName.toLocaleLowerCase() != "rhcl-radio" && inputArray[element].tagName.toLocaleLowerCase() != "rhcl-datepicker" ) { if (inputArray[element].value != undefined) { var noStringsInput = inputArray[element].value.replace(/["']/g, ""); leadApiRequestObject[inputArray[element].name] = noStringsInput; if ( document.querySelector("[data-attribute-iz]") != null && inputArray[element].tagName.toLocaleLowerCase() === "rhcl-radio-group" ) { if (inputArray[element].value.toLocaleLowerCase() === "client") { newsApiObject["newsClient"] = "True"; newsApiObject["newsCandidate"] = "False"; } else if ( inputArray[element].value.toLocaleLowerCase() === "candidate" ) { newsApiObject["newsClient"] = "False"; newsApiObject["newsCandidate"] = "True"; } } else { newsApiObject[inputArray[element].name] = inputArray[element].value; candidateWorkHistory[inputArray[element].name] = inputArray[element].value; } if (unifiedProfileObject != null) { if (inputArray[element].name in unifiedProfileObject) { if (inputArray[element].name === "email") { unifiedProfileObject["emailAddress"] = inputArray[element].value; } else if (inputArray[element].name === "emailAddress") { unifiedProfileObject["email"] = inputArray[element].value; } else if (inputArray[element].name === "fullName") { unifiedProfileObject["fullName"] = inputArray[element].value; } else if (inputArray[element].name === "officeInfo") { unifiedProfileObject["officeInfo"] = inputArray[element].value; } else if (inputArray[element].name === "businessPhone") { unifiedProfileObject["businessPhone"] = inputArray[element].value; } unifiedProfileObject[inputArray[element].name] = inputArray[element].value; if ( unifiedProfileObject.peopleNumber != "" && endpointType === "leads" ) { leadApiRequestObject["peopleNumber"] = unifiedProfileObject.peopleNumber; } if (unifiedProfileObject.contactSfID != "") { newsApiObject["sfContactID"] = unifiedProfileObject.contactSfID; } } if (unifiedProfileObject.contactSfID != "") { candidateWorkHistory["subscriberKey"] = unifiedProfileObject.contactSfID; } } if ( !leadApiRequestObject.rhInternalTrackingType || leadApiRequestObject.rhInternalTrackingType === "Not found" ) { // if the tracking type isn't already set by an ad campaign url leadApiRequestObject["rhInternalTrackingType"] = unifiedProfileObject.isLoggedIn ? "LUX" : "RH Website Visitor"; } } } if ( inputArray[element].tagName.toLocaleLowerCase() === "rhcl-datepicker" ) { if (inputArray[element].value === "") { candidateWorkHistory[inputArray[element].name] = ""; } else { candidateWorkHistory[inputArray[element].name] = changeDateFormat( inputArray[element].value ); } } } var radioValue = document.querySelectorAll("form rhcl-radio:checked"); if (radioValue != null) { radioValue.forEach(function (element) { leadApiRequestObject[element.name] = element.value; newsApiObject[element.name] = element.value; candidateWorkHistory[element.name] = element.value; if (unifiedProfileObject != null) { if (element.name in unifiedProfileObject) { unifiedProfileObject[element.name] = element.value; } } }); } if ( document.querySelectorAll("[data-attribute-iz]").length > 0 && "radioButton" in newsApiObject ) { delete newsApiObject.radioButton; } if ( document.querySelectorAll("[data-attribute-iz]").length > 0 && "radioButtons" in newsApiObject ) { delete newsApiObject.radioButtons; } if ("formType" in newsApiObject) { delete newsApiObject.formType; } var checkboxValue = document.querySelectorAll("form rhcl-checkbox"); if (checkboxValue.length > 0) { checkboxValue.forEach(function (element) { if (element.selected === true) { if (element.name != null) { leadApiRequestObject[element.name] = element.value || "true"; newsApiObject[element.name] = element.value || "true"; candidateWorkHistory[element.name] = element.value || "true"; if (unifiedProfileObject != null) { if (element.name in unifiedProfileObject) { unifiedProfileObject[element.name] = element.value || "true"; } } } } else { if (leadApiRequestObject.hasOwnProperty(element.name)) { delete leadApiRequestObject[element.name]; } leadApiRequestObject[element.name] = "false"; newsApiObject[element.name] = element.value || "false"; candidateWorkHistory[element.name] = element.value || "false"; } }); } if (unifiedProfileObject != null) { window.setUPO(unifiedProfileObject); } if (document.querySelectorAll(".form-btn").length > 0) { return newsApiObject; } if ( document.querySelectorAll("input[name='formName']").length > 0 && document.querySelectorAll("input[name='formName']").value === "form_na_candidate_work_history" ) { return candidateWorkHistory; } return leadApiRequestObject; } function changeDateFormat(inputDate) { if (inputDate) { var splitDate = inputDate.split("-"); if (splitDate.count === 0) { return null; } var year = splitDate[0]; var month = splitDate[1]; var day = splitDate[2]; return month + "-" + day + "-" + year; } else { return ""; } } function retrieveJobAlertsInputFields(inputElement, inputValues) { if (inputElement.name === null) { return inputValues; } if (inputElement.name.toLocaleLowerCase() === "searchterms") { inputValues.searchTerms = inputElement.value || ""; } if (inputElement.name.toLocaleLowerCase() === "email") { inputValues.emailAddress = inputElement.value || ""; } if (inputElement.name.toLocaleLowerCase() === "location") { inputValues.location = inputElement.value || ""; } return inputValues; } function updateJobAlertDetails(inputValues) { let pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); if (pagePath) { inputValues.country = pagePath.split("/")[1]; inputValues.language = pagePath.split("/")[2]; } jobAlertRequestObject.candidateEmailAddress = inputValues.emailAddress; jobAlertRequestObject.keywords = inputValues.searchTerms; jobAlertRequestObject.keywordsNoSpaces = inputValues.searchTerms.replace( /\s+/g, "" ); jobAlertRequestObject.location = inputValues.location; jobAlertRequestObject.locationNoSpaces = inputValues.location.replace( /\s+/g, "" ); jobAlertRequestObject.locale = inputValues.language.toLowerCase() + "_" + inputValues.country.toUpperCase(); jobAlertRequestObject.countryCode = inputValues.country.toLowerCase(); jobAlertRequestObject.insrtDttmHist = new Date().toISOString(); jobAlertRequestObject.subscriptionSourceUrl = window.location.href; jobAlertRequestObject.searchResultsUrl = window.location.origin + "/" + inputValues.country.toLowerCase() + "/" + inputValues.language.toLowerCase() + "/jobs/" + inputValues.location.replace(/ /g, "-") + "/" + encodeURIComponent(inputValues.searchTerms); const randomString = Math.random().toString(36).slice(2, 12); const timestamp = Date.now().toString().slice(-10); jobAlertRequestObject.jobAlertsSubscriptionId = `${randomString}_${timestamp}`; } } window.verifyCallback = function verifyCallback(response) { recaptchaFlag = 1; leadApiRequestObject["interactiveRecaptchaToken"] = response; candidateWorkHistory["interactiveRecaptchaToken"] = response; newsApiObject["interactiveRecaptchaToken"] = response; if (leadApiRequestObject.hasOwnProperty("invisibleRecaptchaToken")) { delete leadApiRequestObject.invisibleRecaptchaToken; } if (candidateWorkHistory.hasOwnProperty("invisibleRecaptchaToken")) { delete candidateWorkHistory.invisibleRecaptchaToken; } if (newsApiObject.hasOwnProperty("invisibleRecaptchaToken")) { delete newsApiObject.invisibleRecaptchaToken; } }; function showInteractiveReCaptcha() { recaptchaFlag = 1; var key = document.querySelectorAll(".form-btn").length > 0 ? document .querySelector(".form-btn rhcl-button") .getAttribute("interactive-key") : document .querySelector(".form-submit-btn rhcl-button") .getAttribute("interactive-key"); // Create the interactive reCAPTCHA HTML var recaptchaContainer = document.createElement("span"); recaptchaContainer.id = "grecaptcha-interactive"; recaptchaContainer.className = "g-recaptcha"; recaptchaContainer.setAttribute("data-sitekey", key); recaptchaContainer.setAttribute("data-callback", "verifyCallback"); recaptchaContainer.setAttribute("theme", "light"); var formGeneral = document.querySelector(".form-submit-btn"); var formNews = document.querySelector(".form-btn"); if (formGeneral != null) { document .querySelector(".form-submit-btn") .insertBefore( recaptchaContainer, document.querySelector(".form-submit-btn").firstChild ); } if (formNews != null) { document .querySelector(".form-btn") .insertBefore( recaptchaContainer, document.querySelector(".form-btn").firstChild ); } // Render the interactive reCAPTCHA grecaptcha.render(recaptchaContainer, { sitekey: key, }); //ajax call in which we will get the score //passes } function validateRecaptcha(input, thisInstance, form) { var key = document.querySelectorAll(".form-btn").length > 0 ? document .querySelector(".form-btn rhcl-button") .getAttribute("invisible-key") : document .querySelector(".form-submit-btn rhcl-button") .getAttribute("invisible-key"); grecaptcha.enterprise.ready(function () { grecaptcha.enterprise .execute(key, { action: "click", }) .then(function (token) { leadApiRequestObject["invisibleRecaptchaToken"] = token; candidateWorkHistory["invisibleRecaptchaToken"] = token; newsApiObject["invisibleRecaptchaToken"] = token; ajaxCall(input, thisInstance, form); }); }); } async function validateForm(input, thisInstance, form) { let isValid = true; const fieldsToValidate = input; const promises = []; var flag = 1; fieldsToValidate.forEach((elem) => { if ( typeof elem.validate === "function" && !elem.getAttribute("form-submission-hidden") ) { promises.push(elem.validate()); } }); // wait for all promises to be finished await Promise.allSettled(promises).then(async (results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); const parameters = getURLParameters(); var params = Object.keys(parameters); flag = getByPassStatus(params); var postalCode = getPostalCodeInForm(); if (isValid && postalCode && isCountryUS()) { const isPostalCodeInvalid = getPostalCodeErrorValidity(); if (isPostalCodeInvalid) { isValid = false; } } // getEmailField and email valid functions are written in emailValidation.html file. var emailField = getEmailField(); if ( isValid && emailField ) { //If leads Submission we want to force validation on email field let isLeadsSubmission = false; //check if form is set to submit with leads endpoint formActionUrlIterable.forEach(([key]) => { if (key === "leads") { isLeadsSubmission = true; } }); //here we will make the call to validate email field if the field is // authored for validation or the submission is to leads if ( window.shouldCheckEmailValidation && typeof window.shouldCheckEmailValidation === "function" && shouldCheckEmailValidation(emailField.value, isLeadsSubmission) ) { emailField.removeAttribute("custom-invalid"); emailField.customInvalid = null; const isEmailCustomValid = checkEmailValidityForCustomDomains( emailField.value ); if (!isEmailCustomValid) { isValid = false; } setEmailCustomErrorMessage(isLeadsSubmission); if (isValid) { // check email for candidate restricted emails document.querySelector("#backdrop").style.display = "block"; await window.ssjoCandidateEmailCheck(isLeadsSubmission); document.querySelector("#backdrop").style.display = "none"; if (emailField.customInvalid) { isValid = false; } } } } if (isValid) { form.nextElementSibling.style.display = "block"; if (test && flag) { if (recaptchaFlag === 0) { validateRecaptcha(input, thisInstance, form); } else ajaxCall(input, thisInstance, form); } if (!test && !flag) { ajaxCall(input, thisInstance, form); } if (test && !flag) { ajaxCall(input, thisInstance, form); } if (!test && flag) { ajaxCall(input, thisInstance, form); } } }); } function recaptchaStatus() { var flag = 1; const parameters = getURLParameters(); var params = Object.keys(parameters); flag = getByPassStatus(params); if (test) { leadApiRequestObject["recaptchaEnabled"] = "true"; newsApiObject["recaptchaEnabled"] = "true"; candidateWorkHistory["recaptchaEnabled"] = "true"; } else { leadApiRequestObject["recaptchaEnabled"] = "false"; newsApiObject["recaptchaEnabled"] = "false"; candidateWorkHistory["recaptchaEnabled"] = "false"; } if (!flag) { leadApiRequestObject["recaptchaEnabled"] = "false"; leadApiRequestObject[bypassPerimeter] = parameters[bypassPerimeter]; newsApiObject["recaptchaEnabled"] = "false"; newsApiObject[bypassPerimeter] = parameters[bypassPerimeter]; candidateWorkHistory["recaptchaEnabled"] = "false"; candidateWorkHistory[bypassPerimeter] = parameters[bypassPerimeter]; } } function getLeadId() { if (document.querySelector("#leadId") != null) { var leadId = crypto.randomUUID(); var leadIdArray = [...document.querySelectorAll("#leadId")]; leadIdArray.forEach(function (ele) { ele.value = "rhwebsite_" + leadId; }); } } /*************************** Salary Guide Gating Logic*********************************************/ window.ready(function () { if (document.querySelector(".salary-guide") != null) { var currentUrl = new URL(window.location); if (currentUrl.pathname.includes(".html")) { var urlString = currentUrl.pathname.split("."); currentUrl = urlString[0]; } else { currentUrl = currentUrl.pathname; } if ( currentUrl.endsWith("salary-guide") || currentUrl.endsWith("guide-salarial") || currentUrl.endsWith("gehaltsuebersicht") || currentUrl.endsWith("salarisgids") || currentUrl.endsWith("guide-des-salaires") || currentUrl.endsWith("guia-salarial") ) { if (localStorage.getItem("unifiedProfileObject") != null) { var upo = window.getUPO(); var cookie = getCookie("wcmmode"); const gatingPropertyEl = document.querySelector(".gating-properties"); if (gatingPropertyEl != null && cookie != "edit") { var gatingproperty = gatingPropertyEl.getAttribute("gatingproperty") !== undefined ? gatingPropertyEl.getAttribute("gatingproperty") : "sgGatingFormSubmitted"; if (upo.hasOwnProperty(gatingproperty)) { var redirecturl = gatingPropertyEl.getAttribute("gatedredirect") != undefined ? gatingPropertyEl.getAttribute("gatedredirect") : ""; if (redirecturl != "") { window.location.replace(redirecturl); } } } } } } }); function checkQueryString(field) { var url = window.location.href; if (url.indexOf("?" + field + "=") != -1) { return true; } else if (url.indexOf("&" + field + "=") != -1) { return true; } return false; } function getURLParameter(sParam) { var sPageURL = new URL(window.location); sPageURL = sPageURL.search.substring(1); var sURLVariables = sPageURL.split("&"); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split("="); if (sParameterName[0] === sParam) { return sParameterName[1]; } } } //current date and time in format YYYY-MM-DD HH:MM:SS function currentDateTime() { var d = new Date(); d = d.getFullYear() + "-" + (d.getMonth() + 1 < 10 ? "0" + (d.getMonth() + 1) : d.getMonth() + 1) + "-" + (d.getDate() < 10 ? "0" + d.getDate() : d.getDate()) + " " + (d.getHours() < 10 ? "0" + d.getHours() : d.getHours()) + ":" + (d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes()) + ":" + (d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds()); return d; } function getSubmissionDate() { if (document.querySelector("#submissionDateTime") != null) { document.querySelector("#submissionDateTime").value = currentDateTime(); } if (document.querySelector("#submissionDate") != null) { document.querySelector("#submissionDate").value = currentDateTime(); } } window.ready(function () { /***************************on focus analytics*********************************************/ var refreshCount = 0; document.querySelector(".form-container [rhcl-input][required]") && document .querySelector(".form-container [rhcl-input][required]") .addEventListener("focus", () => { refreshCount += 1; var formTypeVal = document.querySelector( ".rhformhiddenfield input[name=formType]" ); var analyticObj = { tealium_event: "focus_click", datalayer_version: 2, event_action: "focus", event_text: document .querySelector(".form-container [rhcl-input][required]") .getAttribute("name"), form_type: formTypeVal?.value ? formTypeVal?.value : "", }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } if (refreshCount < 2) { rh_datalayer_add(analyticObj, "event"); } }); }); }()) </script> <!-- Conditional form routing data --> <form action="https://prd-dr.lp.api.roberthalfonline.com/proxy-lead-processing/send" class="form-container" data-attribute-ssjo="leads"> <span type="hidden" id="bypassToken" name="bypassToken" value="bypassToken"></span> <rhcl-alert hidden data-status="500" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="502" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="503" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="504" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="error" headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="positionTitleError" copy="Sorry, we don’t staff the role of {positionTitle} at this time." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="postalCodeError" copy="Robert Half cannot support staffing needs in {postalCode} at this time." headline="Error!"></rhcl-alert> <div class="root container-fluid cmp-container"> <div class="form-field-set row"> <div class="field-set-header"> <rhcl-heading modifier="" tag="h2" theme="" variant="display5"></rhcl-heading> </div> <div class="field-element-row col-md-12"> <div class="row"> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="root container-fluid cmp-container aem-GridColumn aem-GridColumn--default--12"> <rhcl-typeahead label="Job Title" max-results="30" name="positionTitle" size="small" theme="concrete" required max-length="60" min-length="2" min-length-message="Job title must have at least 2 characters" max-length-message="Do not enter more than 60 characters for Job Title" error-message="Please enter a valid job title" endpoint="https://gen.api.roberthalfonline.com/auto-complete-aem/job-function?country=us&language=en&max-result=30&job-title=:value" error-message-lp="Please enter a valid job title"> </rhcl-typeahead> <script> window.ready(() => { window.addEventListener("rhcl-typeahead-changed", e => { const typeahead = e.target typeahead.customInvalid = null; typeahead.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <div hidden id="rhFormTextField" data-pattern="^[0-9]{5}(-[0-9]{4})?$" data-errorMessage="Please enter a valid zip code"></div> <rhcl-text-field id="rhcl-text-field-1990100796" label="Zip Code" type="text" required pattern="^[0-9]{5}(-[0-9]{4})?$" error-message="Please enter a valid zip code" format-message="Please enter a valid zip code" size="small" theme="concrete" name="postalCode" error-message-lp="Robert Half cannot support staffing needs in [token:value]"> </rhcl-text-field> <script> var element = document.getElementById("rhcl-text-field-1990100796"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="root container-fluid cmp-container aem-GridColumn aem-GridColumn--default--12"> <a id="employmentType" hidden></a> <rhcl-dropdown label="Position Type" required error-message="Please select a position type" size="small" theme="concrete" value="Please Select" name="positionType"> <rhcl-dropdown-item slot="item" value="perm"> Permanent Placement </rhcl-dropdown-item> <rhcl-dropdown-item slot="item" value="temp"> Contract Talent </rhcl-dropdown-item> </rhcl-dropdown> </div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="root container-fluid cmp-container aem-GridColumn aem-GridColumn--default--12"> <rhcl-dropdown label="Estimated Start Date" required error-message="Please select an estimated start date" size="small" theme="concrete" value="startDate" name="startDate"> <rhcl-dropdown-item slot="item" value="now"> As soon as possible </rhcl-dropdown-item> <rhcl-dropdown-item slot="item" value="month"> Within a month </rhcl-dropdown-item> <rhcl-dropdown-item slot="item" value="max"> Not sure, still planning </rhcl-dropdown-item> </rhcl-dropdown> </div> </div> </div> <div class="col-md-12 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> </div> </div> <div class="col-md-12 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="conditionalfields aem-GridColumn aem-GridColumn--default--12"> <script type="text/javascript"> let ranSetup = false; const setup = () => { const isEditMode = !!window.Granite && window.Granite.author if (ranSetup) return; ranSetup = true; if (!window.common?.getElementByJumpLinkId) { window.common = { ...window.common, getElementByJumpLinkId: (id) => { let el = document.getElementById(id) if (!el) return; const allowedNodeNames = [ 'RHCL-TEXT-FIELD', 'RHCL-TEXTAREA', 'RHCL-DATEPICKER', 'RHCL-TYPEAHEAD', 'RHCL-CHECKBOX', 'RHCL-CHECKBOX-GROUP', 'RHCL-RADIO-GROUP', 'RHCL-DROPDOWN', 'RHCL-SWITCH' ]; while (el && el.nextElementSibling && !allowedNodeNames.includes(el.nodeName)) { el = el.nextElementSibling; } if (el && !allowedNodeNames.includes(el.nodeName)) { // there was no sibling to the element with that id that is a valid input console.error('Could not find a valid input element with this id:', id); // return undefined instead of last found node return; } return el; } } } const allowedNodeNames = [ 'RHCL-TEXT-FIELD', 'RHCL-TEXTAREA', 'RHCL-DATEPICKER', 'RHCL-TYPEAHEAD', 'RHCL-CHECKBOX', 'RHCL-CHECKBOX-GROUP', 'RHCL-RADIO-GROUP', 'RHCL-DROPDOWN', 'RHCL-SWITCH' ]; const hideElement = (el) => { // hide the element el.style.display = 'none'; // look at all child elements and mark them to not be sent in the form // set original-name and original-value to element name and value // and remove element name and value so it is not included in form data const replaceNames = (el) => { if (allowedNodeNames.includes(el.nodeName) || el.nodeName === 'INPUT') { if (el.getAttribute && el.getAttribute('name')) { el.setAttribute('form-submission-hidden', 'true'); el.setAttribute('original-name', el.getAttribute('name')); el.removeAttribute('name'); if (el.getAttribute('value')) { el.setAttribute('original-value', el.getAttribute('value')); el.removeAttribute('value'); } } } Array.from(el.children).forEach(replaceNames); }; Array.from(el.children).forEach(replaceNames); } const showElement = (el) => { el.style.display = 'block'; const replaceNames = (el) => { if (allowedNodeNames.includes(el.nodeName) || el.nodeName === 'INPUT') { if (el.getAttribute && el.getAttribute('original-name')) { el.removeAttribute('form-submission-hidden'); el.setAttribute('name', el.getAttribute('original-name')); el.removeAttribute('original-name'); if (el.getAttribute('original-value')) { el.setAttribute('value', el.getAttribute('original-value')); el.removeAttribute('original-value'); } } } Array.from(el.children).forEach(replaceNames) } Array.from(el.children).forEach(replaceNames) } const conditionalGroups = document.querySelectorAll('.conditional-group'); Array.from(conditionalGroups).forEach(group => { const controlContainer = group.querySelector('.conditional-field') const displayContainer = group.querySelector('.conditional-fields') const isIndependentConditional = !controlContainer; const independentControlId = isIndependentConditional && group.getAttribute('data-independent-control-id'); const independentControl = window.common.getElementByJumpLinkId(independentControlId); if (isIndependentConditional && !independentControl) { // group is not setup correctly console.error('Conditional group has no determining field'); return; } const controlElement = independentControl || controlContainer.querySelector('rhcl-switch'); const config = JSON.parse(displayContainer.getAttribute('data-config')); const requiredDisplayValues = config.active || []; const isControlActive = () => { if (controlElement.nodeName === 'RHCL-CHECKBOX') { return controlElement.selected; } return requiredDisplayValues.includes(controlElement.value) && controlElement.value !== ''; } const onChanged = () => { if (isControlActive()) { showElement(displayContainer); } else { hideElement(displayContainer); } } // listen for control element value changes // need observer since rhcl components don't fire change events function valChanged(mutationList, observer) { mutationList.forEach(mutation => { if ( mutation.type === 'attributes' && (mutation.attributeName === 'value' || mutation.attributeName === 'selected') ) { onChanged(); } }) } const observer = new MutationObserver(valChanged); observer.observe(controlElement, { attributes: true, attributeFilter: ['value', 'selected'] }); if (isEditMode) { // on first render for edit mode show element controlElement.value = requiredDisplayValue; } else { onChanged(); } }) } setTimeout(() => { setup(); }, 1000); window.ready(function() { setup(); }); window.setup = setup; </script> <div class="conditional-group" data-independent-control-id="employmentType"> <!-- conditional field controller --> <!-- conditional fields --> <div class="conditional-fields" data-config='{"active": ["perm"]}'> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="root container-fluid cmp-container aem-GridColumn aem-GridColumn--default--12"> <div class="form-field-set row"> <div class="field-set-header"> <rhcl-heading modifier="" tag="h2" theme="" variant="display5"></rhcl-heading> </div> <div class="field-element-row col-md-12"> <div class="row"> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <rhcl-text-field id="rhcl-text-field--677552827" label="Min. Salary" type="text" required min-length="1" error-message="required" format-message="please enter a valid number" icon-leading="dollar-sign" size="small" theme="concrete" name="payRateMin"> </rhcl-text-field> <script> document.getElementById("rhcl-text-field--677552827").addEventListener("rhcl-text-field-blur", customValidations); function customValidations() { let isValid = true; const promises = []; document.getElementById("rhcl-text-field--677552827").removeAttribute("custom-invalid"); document.getElementById("rhcl-text-field--677552827").customInvalid = null; promises.push(document.getElementById("rhcl-text-field--677552827").validate()); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { var customPatternString = "^(0|[1\u002D9][0\u002D9]*)$"; var customErrorMessages = "Please remove any special characters"; var patterns = customPatternString.split(",regex,"); var messages = customErrorMessages.split(",regex,"); var value = this.value; var initialMessage = this.getAttribute("custom-error-message"); var flag = 0; for (var i = 0; i < patterns.length; i++) { var pattern; var stringPattern = patterns[i]; var dollar = stringPattern.charAt(stringPattern.length - 1); if (dollar != '$') pattern = stringPattern + '$'; else pattern = stringPattern; var reg = new RegExp(pattern); var result = reg.test(value); if (result == false) { flag = 1; if (initialMessage != null) { if (!initialMessage.includes(messages[i])) initialMessage = initialMessage + " " + messages[i] + " "; } if (initialMessage == null) { initialMessage = messages[i] + " "; } } else if (result == true) { if (initialMessage != null && initialMessage.includes(messages[i])) { initialMessage = initialMessage.replace(messages[i], ''); } } } if (flag == 1) { this.setAttribute("custom-invalid", ""); } else this.removeAttribute("custom-invalid"); if (initialMessage != null && initialMessage != " " && initialMessage != "") this.setAttribute("custom-error-message", initialMessage); } }); } </script> <script> { const SELECTOR = "rhcl-text-field--677552827"; const type = document.getElementById(SELECTOR).getAttribute("type"); { // setup dataset with numeric model configuration const minValue = parseInt( "1", 10 ); const maxValue = parseInt( "", 10 ); const invalidRangeErrorMessage = "Please enter a value greater than $1."; const relatedMaxElId = "payRateMax"; const minValueOverMaxErrorMessage = ""; const thisEl = document.getElementById(SELECTOR); thisEl.setAttribute("data-related-max-element-id", relatedMaxElId); thisEl.setAttribute( "data-min-value-over-max-error-message", minValueOverMaxErrorMessage ); thisEl.setAttribute( "data-invalid-range-error-message", invalidRangeErrorMessage ); thisEl.setAttribute("data-min-value", minValue); thisEl.setAttribute("data-max-value", maxValue); document .getElementById(SELECTOR) .addEventListener("rhcl-text-field-blur", numericValidation); } function numericValidation() { let isValid = true; const promises = []; const fieldEl = document.getElementById(SELECTOR); fieldEl.removeAttribute("custom-invalid"); fieldEl.customInvalid = null; promises.push(fieldEl.validate()); // check other field validations first Promise.allSettled(promises) .then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); }) .then(() => { if (isValid) { handleRelatedElementValidation(fieldEl); handleNumericValidation(fieldEl); } }); } // validation logic for multiple connected text fields where one must have lower value than the other function handleRelatedElementValidation(fieldEl) { // grab the id from the anchor el added before this field el const fieldId = fieldEl?.previousElementSibling?.id; if (fieldId) { // check if there are elements that require this element to have a greater value const lowerElements = [ ...document.querySelectorAll( "[data-related-max-element-id='" + fieldId + "']" ), ]; if (lowerElements.length) { const greaterElHasLowerValue = lowerElements.some( (lowerElement) => { const lowerValue = parseInt( lowerElement.value?.replace(/[,.]/g, ""), 10 ); if ( lowerValue !== NaN && lowerValue >= fieldEl.value && !lowerElement.customInvalid ) { // the lower value is greater than this max field value return true; } } ); if (greaterElHasLowerValue) { fieldEl.setAttribute( "custom-error-message", fieldEl.dataset.minValueOverMaxErrorMessage ); fieldEl.setAttribute("custom-invalid", true); } else if ( fieldEl.customInvalid && fieldEl.customErrorMessage === fieldEl.dataset.minValueOverMaxErrorMessage ) { // if there were no fields greater than a max field // and the greater field had an error for that case clear it clearError(fieldEl); } } } else if ( Object.keys(fieldEl.dataset).includes("relatedMaxElementId") ) { // check validation on related max elements document .querySelectorAll("#" + fieldEl.dataset.relatedMaxElementId) .forEach((el) => { handleRelatedElementValidation(el.nextElementSibling); }); } } function clearError(el) { el.removeAttribute("custom-invalid"); el.removeAttribute("custom-error-message"); } function handleNumericValidation(fieldEl) { if ( fieldEl.customInvalid && fieldEl.customErrorMessage ) { // already has error message set, skip additional validation fieldEl.needsValidation = true; return; } let relatedMaxEl = fieldEl.dataset.relatedMaxElementId && document.getElementById(fieldEl.dataset.relatedMaxElementId); if ( relatedMaxEl && relatedMaxEl.nodeName == "A" && relatedMaxEl.nextElementSibling?.nodeName === "RHCL-TEXT-FIELD" ) { // if ID is set by jump anchor the actual element with the text is the next sibling relatedMaxEl = relatedMaxEl.nextElementSibling; } let errorMessage = null; if ( (parseInt(fieldEl.dataset.minValue, 10) !== NaN && parseInt(fieldEl.value, 10) < parseInt(fieldEl.dataset.minValue, 10)) || (parseInt(fieldEl.dataset.maxValue, 10) !== NaN && parseInt(fieldEl.value, 10) > parseInt(fieldEl.dataset.maxValue, 10)) ) { errorMessage = fieldEl.dataset.invalidRangeErrorMessage; } else if ( relatedMaxEl && parseInt(relatedMaxEl.value, 10) <= parseInt(fieldEl.value, 10) ) { // min field was greater than max field errorMessage = fieldEl.dataset.minValueOverMaxErrorMessage; } if (errorMessage) { fieldEl.setAttribute("custom-error-message", errorMessage); fieldEl.setAttribute("custom-invalid", true); } else { clearError(fieldEl); } } } </script> <script> var element = document.getElementById("rhcl-text-field--677552827"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <a id="payRateMax" hidden></a> <rhcl-text-field id="rhcl-text-field--1728619634" label="Max. Salary" type="text" required error-message="required" icon-leading="dollar-sign" size="small" theme="concrete" name="payRateMax"> </rhcl-text-field> <script> document.getElementById("rhcl-text-field--1728619634").addEventListener("rhcl-text-field-blur", customValidations); function customValidations() { let isValid = true; const promises = []; document.getElementById("rhcl-text-field--1728619634").removeAttribute("custom-invalid"); document.getElementById("rhcl-text-field--1728619634").customInvalid = null; promises.push(document.getElementById("rhcl-text-field--1728619634").validate()); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { var customPatternString = "^(0|[1\u002D9][0\u002D9]*)$"; var customErrorMessages = "Please remove any special characters"; var patterns = customPatternString.split(",regex,"); var messages = customErrorMessages.split(",regex,"); var value = this.value; var initialMessage = this.getAttribute("custom-error-message"); var flag = 0; for (var i = 0; i < patterns.length; i++) { var pattern; var stringPattern = patterns[i]; var dollar = stringPattern.charAt(stringPattern.length - 1); if (dollar != '$') pattern = stringPattern + '$'; else pattern = stringPattern; var reg = new RegExp(pattern); var result = reg.test(value); if (result == false) { flag = 1; if (initialMessage != null) { if (!initialMessage.includes(messages[i])) initialMessage = initialMessage + " " + messages[i] + " "; } if (initialMessage == null) { initialMessage = messages[i] + " "; } } else if (result == true) { if (initialMessage != null && initialMessage.includes(messages[i])) { initialMessage = initialMessage.replace(messages[i], ''); } } } if (flag == 1) { this.setAttribute("custom-invalid", ""); } else this.removeAttribute("custom-invalid"); if (initialMessage != null && initialMessage != " " && initialMessage != "") this.setAttribute("custom-error-message", initialMessage); } }); } </script> <script> { const SELECTOR = "rhcl-text-field--1728619634"; const type = document.getElementById(SELECTOR).getAttribute("type"); { // setup dataset with numeric model configuration const minValue = parseInt( "1", 10 ); const maxValue = parseInt( "", 10 ); const invalidRangeErrorMessage = "Please enter a value greater than $1."; const relatedMaxElId = ""; const minValueOverMaxErrorMessage = "Maximum salary must be greater than minimum salary"; const thisEl = document.getElementById(SELECTOR); thisEl.setAttribute("data-related-max-element-id", relatedMaxElId); thisEl.setAttribute( "data-min-value-over-max-error-message", minValueOverMaxErrorMessage ); thisEl.setAttribute( "data-invalid-range-error-message", invalidRangeErrorMessage ); thisEl.setAttribute("data-min-value", minValue); thisEl.setAttribute("data-max-value", maxValue); document .getElementById(SELECTOR) .addEventListener("rhcl-text-field-blur", numericValidation); } function numericValidation() { let isValid = true; const promises = []; const fieldEl = document.getElementById(SELECTOR); fieldEl.removeAttribute("custom-invalid"); fieldEl.customInvalid = null; promises.push(fieldEl.validate()); // check other field validations first Promise.allSettled(promises) .then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); }) .then(() => { if (isValid) { handleRelatedElementValidation(fieldEl); handleNumericValidation(fieldEl); } }); } // validation logic for multiple connected text fields where one must have lower value than the other function handleRelatedElementValidation(fieldEl) { // grab the id from the anchor el added before this field el const fieldId = fieldEl?.previousElementSibling?.id; if (fieldId) { // check if there are elements that require this element to have a greater value const lowerElements = [ ...document.querySelectorAll( "[data-related-max-element-id='" + fieldId + "']" ), ]; if (lowerElements.length) { const greaterElHasLowerValue = lowerElements.some( (lowerElement) => { const lowerValue = parseInt( lowerElement.value?.replace(/[,.]/g, ""), 10 ); if ( lowerValue !== NaN && lowerValue >= fieldEl.value && !lowerElement.customInvalid ) { // the lower value is greater than this max field value return true; } } ); if (greaterElHasLowerValue) { fieldEl.setAttribute( "custom-error-message", fieldEl.dataset.minValueOverMaxErrorMessage ); fieldEl.setAttribute("custom-invalid", true); } else if ( fieldEl.customInvalid && fieldEl.customErrorMessage === fieldEl.dataset.minValueOverMaxErrorMessage ) { // if there were no fields greater than a max field // and the greater field had an error for that case clear it clearError(fieldEl); } } } else if ( Object.keys(fieldEl.dataset).includes("relatedMaxElementId") ) { // check validation on related max elements document .querySelectorAll("#" + fieldEl.dataset.relatedMaxElementId) .forEach((el) => { handleRelatedElementValidation(el.nextElementSibling); }); } } function clearError(el) { el.removeAttribute("custom-invalid"); el.removeAttribute("custom-error-message"); } function handleNumericValidation(fieldEl) { if ( fieldEl.customInvalid && fieldEl.customErrorMessage ) { // already has error message set, skip additional validation fieldEl.needsValidation = true; return; } let relatedMaxEl = fieldEl.dataset.relatedMaxElementId && document.getElementById(fieldEl.dataset.relatedMaxElementId); if ( relatedMaxEl && relatedMaxEl.nodeName == "A" && relatedMaxEl.nextElementSibling?.nodeName === "RHCL-TEXT-FIELD" ) { // if ID is set by jump anchor the actual element with the text is the next sibling relatedMaxEl = relatedMaxEl.nextElementSibling; } let errorMessage = null; if ( (parseInt(fieldEl.dataset.minValue, 10) !== NaN && parseInt(fieldEl.value, 10) < parseInt(fieldEl.dataset.minValue, 10)) || (parseInt(fieldEl.dataset.maxValue, 10) !== NaN && parseInt(fieldEl.value, 10) > parseInt(fieldEl.dataset.maxValue, 10)) ) { errorMessage = fieldEl.dataset.invalidRangeErrorMessage; } else if ( relatedMaxEl && parseInt(relatedMaxEl.value, 10) <= parseInt(fieldEl.value, 10) ) { // min field was greater than max field errorMessage = fieldEl.dataset.minValueOverMaxErrorMessage; } if (errorMessage) { fieldEl.setAttribute("custom-error-message", errorMessage); fieldEl.setAttribute("custom-invalid", true); } else { clearError(fieldEl); } } } </script> <script> var element = document.getElementById("rhcl-text-field--1728619634"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div class="col-md-12 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="root container-fluid cmp-container aem-GridColumn aem-GridColumn--default--12"> <rhcl-chip-typeahead add-headline="Skills you've selected for this role" button-label="+" name="skills" chip-limit-error="You've reached the maximum number of skills" chip-required-error="Please make a selection from the list and click the plus sign to add the skill." required="true" typeahead-label="Skills, Tools, Technologies" typeahead-endpoint="https://prd-dr.gen.api.roberthalfonline.com/sf-skills/skillSearch?searchTerm=:value&locale=en-US&maxResults=30" typeahead-suggestion-endpoint="https://prd-dr.gen.api.roberthalfonline.com/sf-skills/skillRecommendation?jobTitle=:value&jobFunctionCode=:code&locale=en-US&maxResults=30&version=2" typeahead-suggestion-label="Add at least 3 to 5 skills to get matches with the experience you need" typeahead-selection-required="true" max-count="10" variant="condensed" remove-headline="Skills you've selected for this role"></rhcl-chip-typeahead> </div> </div> </div> </div> </div> </div> </div> <div class="form-footer row"> <div class="form-submit-btn"> <span id="showRedirectStatus"></span> </div> <div class="form-foot-note col-md-12 px-0"> <span class="rhcl-typography rhcl-typography--variant-legal"> </span> </div> </div> </form> <div id="backdrop" class="d-none"> <div class="loader-div"> <rhcl-loading-spinner label="Please Wait" theme="dark" transparency="partial" style="width: 100%; height: 100%;"/> </div> </div> <script src="https://www.google.com/recaptcha/enterprise.js?render=explicit" async defer> </script> <script> { if (!window.common?.getElementByJumpLinkId) { window.common = { ...window.common, /** * this function is to handle getting the element from the jump link id * */ getElementByJumpLinkId: (id) => { let el = document.getElementById(id) if (!el) return const allowedNodeNames = [ 'RHCL-TEXT-FIELD', 'RHCL-TEXTAREA', 'RHCL-DATEPICKER', 'RHCL-TYPEAHEAD', 'RHCL-CHECKBOX', 'RHCL-CHECKBOX-GROUP', 'RHCL-RADIO-GROUP', 'RHCL-DROPDOWN', 'RHCL-SWITCH' ] while (!!el.nextElementSibling && !allowedNodeNames.includes(el.nodeName)) { el = el.nextElementSibling; } if (!allowedNodeNames.includes(el.nodeName)) { // there was no sibling to the element with that id that is a valid input console.error('Could not find a valid input element with this id:', id) // return undefined instead of last found node return } return el } } } const initialEndpoint = 'https:\/\/prd\u002Ddr.lp.api.roberthalfonline.com\/proxy\u002Dlead\u002Dprocessing\/send'; const initialEndpointType = 'leads'; const basicFormEndpoint = 'https:\/\/prd\u002Ddr.ma.api.roberthalfonline.com\/form\u002Dsubmission\/submit'; const ssjoEndpoint = 'https:\/\/prd\u002Ddr.lp.api.roberthalfonline.com\/proxy\u002Dlead\u002Dprocessing\/send'; const jobAlertsEndpoint = 'https:\/\/prd\u002Ddr.ma.api.roberthalfonline.com\/job\u002Dalerts\/subscribe'; const formContainer = document.querySelector('form.form-container'); // get the form routing destinations const destinations = document.querySelectorAll('input[data-form-routing="true"]') const destinationControls = []; // get array of all destinations controls and required values Array.from(destinations).forEach(destination => { const relatedId = destination.dataset.formRoutingId; const requiredValue = destination.dataset.formRoutingValue; const routingEndpointTypes = destination.dataset.formRoutingSsjoEndpoint; const routingEndpointTypesArray = routingEndpointTypes.split(','); if (!relatedId) return; // skip elements where the dataset has no details // check required value on related id const controlElement = window.common.getElementByJumpLinkId(relatedId); destinationControls.push({controlElement, requiredValue, routingEndpointTypesArray}) }) // listen on any change of the control elements const mutationObserver = new MutationObserver(mutations => { mutations.forEach(mutation => { updateFormEndpoint(); }) }) destinationControls.forEach(({ controlElement }) => { mutationObserver.observe( controlElement, { attributes: true, attributeFilter: ['value', 'selected']} ) }); // update the form action to use the correct endpoint const updateFormEndpoint = () => { let endpointList = {}; let actionEndpoint = initialEndpoint; endpointList[initialEndpointType] = initialEndpoint; destinationControls.some(({ controlElement, requiredValue, routingEndpointTypesArray }) => { if (controlElement.value === requiredValue) { endpointList = {}; routingEndpointTypesArray.forEach((routingEndpointType) => { switch (routingEndpointType) { case 'leads': endpointList['leads'] = ssjoEndpoint; actionEndpoint = ssjoEndpoint; break; case 'nonLeads': endpointList['nonLeads'] = basicFormEndpoint; actionEndpoint = basicFormEndpoint; break; case 'jobAlerts': endpointList['jobAlerts'] = jobAlertsEndpoint; actionEndpoint = jobAlertsEndpoint; break; default: console.log("No EndpointType found for Form Submission. -- ", routingEndpointType); break; } }); return true; } return false; }); formContainer.action = actionEndpoint || formContainer.action; formContainer.dataset.attributeEndpoints = JSON.stringify(endpointList) || formContainer.dataset.attributeEndpoints; }; // initial form endpoint setup updateFormEndpoint(); } </script> </div> </rhcl-progressive-frame-step> </div> <div class="progressiveframestep containernowrapper container responsivegrid" data-aem-wrapper="true" slot="step"> <rhcl-progressive-frame-step disable-back-button="false" label="Contact info" page-type="submit" data-redirect-location="/us/en/hire-talent/email-verification"> <div slot="content"> <style> .form-container{padding:40px 24px} .form-container .form-header{text-align:center;margin-bottom:40px;display:flex;justify-content:center;flex-direction:column;align-items:center} .form-container .form-header .header-text{margin-bottom:26px} .form-container .form-field-set .field-set-header{margin-bottom:24px} .form-container .form-field-set .field-element-row{margin-bottom:8px} .form-container .form-footer{gap:24px;margin-top:28px;justify-content:center} .form-container .form-footer .form-submit-btn{display:flex;justify-content:center;flex-direction:column;align-items:center;gap:24px;#showRedirectStatus{display:none} } .form-container .form-footer .form-submit-btn rhcl-button{width:100%} .form-container .form-footer .form-foot-note{text-align:left} .form-container .form-footer .form-foot-note .rhcl-typography{display:flex;flex-direction:column;gap:16px;padding:0;margin:0 !important;rhcl-typography{text-align:center} } .form-container .form-footer .form-foot-note .rhcl-typography--variant-legal{font-size:12px;letter-spacing:normal;line-height:1.5;font-family:"Noto Sans Regular",OpenSansRegular,"Open Sans Regular","Noto Sans",sans-serif !important} .form-container .form-footer .form-foot-note .rhcl-typography--variant-legal a:hover:after{width:100%;opacity:1} .cmp-experiencefragment .form-container{padding:0} .mobile-app-form .form-foot-note .rhcl-typography p{padding:0;white-space:pre-wrap;margin:0 !important} .mobile-app-form .form-foot-note .rhcl-typography--variant-legal p{font-size:12px;letter-spacing:normal;line-height:1.5;font-family:"Noto Sans Regular",OpenSansRegular,"Open Sans Regular","Noto Sans",sans-serif !important} .mobile-app-form .form-foot-note .rhcl-typography--variant-legal a:hover:after{width:100%;opacity:1} .mobile-app-form .form-div{padding:48px 0 21px 0} #backdrop{position:absolute;top:0;left:0;width:100%;height:100%;z-index:20;background-color:rgba(0,0,0,0.05)} .loader-div{display:flex;justify-content:center;align-items:center;height:100%} @media screen and (min-width:768px){.form-container{padding:48px 40px} .form-container .form-footer .form-submit-btn rhcl-button{width:unset} .form-container .form-footer .form-foot-note{text-align:center} .cmp-experiencefragment .form-container{padding:0} } .cmp-experiencefragment--salary-guide .form-footer{margin-top:0} .grecaptcha-badge{visibility:hidden !important} </style> <script type="text/javascript"> function parseQuery(queryString) { var query = {}; var pairs = ( queryString[0] === "?" ? queryString.substr(1) : queryString ).split("&"); for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split("="); query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ""); } return query; } function phonePrepopFormatter(phone) { const country = window["pageObj"]?.["__extrasettings__"]?.["country"]; if (phone !== null && phone !== undefined) { try { // Remove any non-digit characters let formattedPhone = phone?.replaceAll(/\D/g, ""); if (country === "us" || country === "ca") { // For NA, remove leading 1's and 0's while (/^[01]/.test(formattedPhone.charAt(0))) { formattedPhone = formattedPhone?.substring(1); } } return formattedPhone; } catch (error) { console.error("Failed to format phone:", error); return phone; } } else { return phone; } } function queryParamPrefill() { const handleElementPrefill = (elements, prefillData) => { Object.keys(elements).forEach((name) => { elements[name].forEach((element) => { //handle element auto fill if (element) { switch (element.nodeName) { case "RHCL-DROPDOWN": { const prefillDropdown = (element) => { if (element && element.children && element.children.length) { Array.from(element.children).forEach((child) => { child.selected = prefillData[name] == child.value; }); element.value = prefillData[name]; return true; } }; // try to fill dropdown if (!prefillDropdown(element)) { // if it's not available yet wait for children to be added function onAttributesChanged(_, observer) { // check if child nodes are available const childNodes = Array.from(element.children); for (const child of childNodes) { if (child.value !== undefined) { const prefilled = prefillDropdown(element); if (prefilled) { observer.disconnect(); // disconnect after prefilling } return; } } } // setup attribute mutation observer to fire event with const observer = new MutationObserver(onAttributesChanged); observer.observe(element, { attributes: true }); } break; } case "RHCL-CHECKBOX": { const prefillCheckbox = () => { if (element.interactionRef) { // interactionRef is available, set checked state element.interactionRef.checked = prefillData[name].toLowerCase() == "true"; return true; } }; // if checkbox wasn't available wait for mutation to make it so if (!prefillCheckbox()) { function onMutation(_, observer) { // try to fill checkbox on mutation if (prefillCheckbox()) { // disconnect after prefilling observer.disconnect(); } } // setup attribute mutation observer to fire event with interactionRef const observer = new MutationObserver(onMutation); observer.observe(element, { childList: true, subtree: true, attributes: true, }); } break; } default: element.value = prefillData[name]; if (element.name == "phoneNumber") { let formattedPhone = phonePrepopFormatter(element.value); element.value = formattedPhone; } } } }); }); }; const search = window.location.search; if (search.length && search[0] === "?") { const params = parseQuery(search); //handle form data query param if (params.fd) { const prefillData = parseQuery(atob(params.fd)); const elements = {}; Object.keys(prefillData).forEach((name) => { elements[name] = document.getElementsByName(name); }); const fd = params.fd; if (fd !== null) { const decodedParams = atob(fd); const baseUrl = window.location.origin; let formValue = baseUrl + window.location.pathname + search.replace(/(fd=)[^&$]*/g, decodedParams); if (document.querySelector("#formUrl")) { document.querySelector("#formUrl").value = formValue; handleElementPrefill(elements, prefillData); } } } else { //if no form data query, use all other params and prefill accordingly const elements = {}; Object.keys(params).forEach((name) => { elements[name] = document.getElementsByName(name); }); handleElementPrefill(elements, params); } } } const setRhInternalTracking = () => { // if medium = "Email" tracking = Email Campaign // if medium = "ppc" tracking = Ad Campaign // else tracking = Not found // fd encoded query param has precedence over other query params const trackingTypeElements = document.getElementsByName( "rhInternalTrackingType" ); const trackingValueElements = document.getElementsByName( "rhInternalTrackingValue" ); if (trackingTypeElements.length && window.location.search.length) { const queryParams = parseQuery(window.location.search); const fdParams = queryParams.fd && parseQuery(atob(queryParams.fd)); const medium = (fdParams && fdParams.utm_medium) || queryParams.utm_medium; const campaignValue = (fdParams && fdParams.utm_campaign) || queryParams.utm_campaign || ""; if (medium) { switch (medium.toLowerCase()) { case "paid-social": case "ppc": trackingTypeElements.forEach((el) => (el.value = "Ad Campaign")); break; case "email": trackingTypeElements.forEach((el) => (el.value = "Email Campaign")); break; default: trackingTypeElements.forEach((el) => (el.value = "Not found")); break; } } if (campaignValue) { trackingValueElements.forEach((el) => (el.value = campaignValue)); } } }; /***************************Hidden Field Logic*********************************************/ window.ready(function () { document.querySelectorAll("#backdrop").forEach((ele) => { ele.style.display = "none"; }); if (document.querySelectorAll(".hiddenfield").length > 0) { //get country name from url function getCountryName() { var pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); var country = pagePath.split("/")[1]; country = country != undefined ? country.toUpperCase() : ""; var countryArray = [...document.querySelectorAll("#country")]; countryArray.forEach(function (ele) { ele.value = country; }); } //get language name from url function getLanguageName() { var pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); var language = pagePath.split("/")[2]; var country = pagePath.split("/")[1]; var languageArray = [...document.querySelectorAll("#language")]; languageArray.forEach(function (ele) { ele.value = language + "_" + country; }); } window.addEventListener("rh-client-id-set", function () { getGoogleAnalyticsId(); getTealiumId(); }); //get lob function getLob() { var lob = getURLParameter("lob"); lob = lob != undefined ? lob : ""; var lobArray = [...document.querySelectorAll("#lob")]; lobArray.forEach(function (ele) { ele.value = lob; }); } function getFormUrl() { var formUrlArray = [ ...document.querySelectorAll("#formUrl"), ...document.querySelectorAll("#requestUrl"), ...document.querySelectorAll("#formUrlEncoded"), ]; formUrlArray.forEach(function (ele) { ele.value = new URL(window.location).href; }); } //current date and time in format YYYY-MM-DD HH:MM:SS function currentDateTime() { var d = new Date(); d = d.getFullYear() + "-" + (d.getMonth() + 1 < 10 ? "0" + (d.getMonth() + 1) : d.getMonth() + 1) + "-" + (d.getDate() < 10 ? "0" + d.getDate() : d.getDate()) + " " + (d.getHours() < 10 ? "0" + d.getHours() : d.getHours()) + ":" + (d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes()) + ":" + (d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds()); return d; } function getMiddleInitial() { var middleInitial = currentDateTime(); var middleInitialArray = [...document.querySelectorAll("#middleInitial")]; middleInitialArray.forEach(function (ele) { ele.value = middleInitial; }); } //get ip address function getIpAddress() { fetch("https://jsonip.com/") .then((response) => response.json()) .then((data) => { var ipAddressArray = [ ...document.querySelectorAll("#ipAddress"), ...document.querySelectorAll("#remoteAddrIp"), ]; ipAddressArray.forEach(function (ele) { ele.value = data.ip; }); }) .catch((error) => { console.error("Error fetching IP address:", error); }); } function getGoogleAnalyticsId() { var googleAnalyticsArray = [ ...document.querySelectorAll("#googleAnalyticsId"), ]; googleAnalyticsArray.forEach(function (ele) { ele.value = window.clientId; }); } function getTimeStamp() { var dt = new Date(); var h = dt.getHours(), m = (dt.getMinutes() < 10 ? "0" : "") + dt.getMinutes(); var strDate = dt.getFullYear() + "-" + (dt.getMonth() + 1) + "-" + dt.getDate(); var currentTime = h > 12 ? h - 12 + ":" + m + " PM" : h + ":" + m + " AM"; var currDate = "'" + strDate + "'"; var currentTimeStamp = Date.parse(currDate + currentTime); return currentTimeStamp; } function getSourceId() { var rhdSourceId = getURLParameter("rhdSourceId"); if (rhdSourceId != undefined) { var currentTimeStamp = getTimeStamp(); var rhdSourceIdArray = [...document.querySelectorAll("#rhdSourceId")]; rhdSourceIdArray.forEach(function (ele) { ele.value = rhdSourceId + "-" + currentTimeStamp; }); } else { var formContainer = document.querySelector(".form-container"); var id = formContainer ? formContainer.id : ""; var rhdSourceIdArray = [...document.querySelectorAll("#rhdSourceId")]; rhdSourceIdArray.forEach(function (ele) { ele.value = id + "-" + currentTimeStamp; }); } } function getUtmSource() { var utmsource = getURLParameter("utm_source"); utmsource = utmsource != undefined ? utmsource : ""; var utmSourceArray = [...document.querySelectorAll("#utmSource")]; utmSourceArray.forEach(function (ele) { ele.value = utmsource; }); } function getUtmCampaign() { var campaign = getURLParameter("utm_campaign"); campaign = campaign != undefined ? campaign : ""; var utmCampaignArray = [...document.querySelectorAll("#utmCampaign")]; utmCampaignArray.forEach(function (ele) { ele.value = campaign; }); } function getSfJoNumber() { var sfJoNumber = getURLParameter("sfJoNumber"); sfJoNumber = sfJoNumber != undefined ? sfJoNumber : ""; var sfJoNumberArray = [...document.querySelectorAll("#sfJoNumber")]; sfJoNumberArray.forEach(function (ele) { ele.value = sfJoNumber; }); } function getTealiumId() { var tealiumIdArray = [...document.querySelectorAll("#tealiumId")]; tealiumIdArray.forEach(function (ele) { ele.value = window?.tealiumId; }); } function getGclid() { var searchParams = parseQuery(window.location.search); var gclidVal = searchParams?.gclid ? searchParams.gclid : "not defined"; var gclidArray = [...document.querySelectorAll("#gclid")]; gclidArray.forEach(function (ele) { ele.value = gclidVal; }); } function getSfContactId() { var sfContactId = getURLParameter("sfContactId"); sfContactId = sfContactId != undefined ? sfContactId : ""; var sfContactIdArray = [...document.querySelectorAll("#sfContactId")]; sfContactIdArray.forEach(function (ele) { ele.value = sfContactId; }); } function getURLParameter(sParam) { var sPageURL = new URL(window.location); sPageURL = sPageURL.search.substring(1); var sURLVariables = sPageURL.split("&"); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split("="); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } function updatePageHeading() { var replaceFields = [ { replace: "{positionTitle}", queryParam: "positionTitle" }, { replace: "{city}", queryParam: "city" }, { replace: "{country}", queryParam: "country" }, { replace: "{location}", queryParam: "location" }, { replace: "{jobtitle}", queryParam: "jobtitle" }, ]; const queryParams = parseQuery(window.location.search); replaceFields.forEach((replacement) => { const value = queryParams[replacement.queryParam] || null; const hfbHeadlineElement = document.querySelector( "rhcl-block-hero-form" ); const hfbHeadline = hfbHeadlineElement ? encodeURIComponent(hfbHeadlineElement.getAttribute("headline")) : ""; if (value !== null && hfbHeadline.indexOf(replacement.replace) > -1) { hfbHeadline.replace(replacement.replace, value); document .querySelector("rhcl-block-hero-form") .setAttribute("headline", sentence.replaceAll("%20", " ")); } }); } getCountryName(); getLanguageName(); getLob(); getFormUrl(); getMiddleInitial(); getIpAddress(); getGoogleAnalyticsId(); getSourceId(); getUtmSource(); getUtmCampaign(); getSfJoNumber(); getTealiumId(); getGclid(); getSfContactId(); } if (document.querySelectorAll("rhcl-block-hero-form").length > 0) { updatePageHeading(); } // use fd prefill after to give precedence to fd querystrings setRhInternalTracking(); }); window.addEventListener("rhcl-initialized", () => { queryParamPrefill(); }); queryParamPrefill(); (function() { var test = document.querySelectorAll("#recaptcha").length; var recaptchaFlag = 0; const firstRhclButton = document.querySelector("rhcl-button"); const recaptchaFailMessage = firstRhclButton && firstRhclButton?.getAttribute("data-recaptcha-message"); const recaptchaEndpoint = aemSettings?.rh_common?.recaptchaEndpoint; const bypassToken = document.getElementById("bypassToken"); let formActionUrlIterable = new Map(); let bypassPerimeter = ""; if (bypassToken != null) { bypassPerimeter = bypassToken.getAttribute("value"); } //Request types and associated fields let requestData; var candidateWorkHistory = { recaptchaEnabled: "", invisibleRecaptchaToken: "", subscriberKey: "", }; let jobAlertRequestObject = { candidateEmailAddress: "", locale: "", keywords: "", keywordsNoSpaces: "", subscriptionSource: "rhWebsite", countryCode: "", searchResultsUrl: "", subscriptionSourceUrl: "", postedWithin: "", jobType: "", empType: "", cityId: "", cityTxt: "", jobAlertsSubscriptionId: "", lobName: "", location: "", locationNoSpaces: "", googleAnalyticsClientId: "", emailFrequency: "W", jobOrderRecommendationsCount: "5", insrtDttmHist: "", subscriptionType: "Manual", status: "A", }; var leadApiRequestObject = { recaptchaEnabled: "", invisibleRecaptchaToken: "", servicePreference: "", startDate: "", languageLocale: "", rhAnalyticsAddInfo: "", routingEmail: "", candidateReference1: "", candidateFunctionalRole1: "", candidateReference2: "", candidateFunctionalRole2: "", candidateReference3: "", candidateFunctionalRole3: "", candidateReference4: "", candidateFunctionalRole4: "", candidateReference5: "", candidateFunctionalRole5: "", additionalAttribute1: "", additionalAttribute2: "", additionalAttribute3: "", additionalAttribute4: "", additionalAttribute5: "", skillsRequested: "", experienceDurationMin: "", experienceDurationMax: "", experiencePeriod: "", educationLevel: "", payRateMin: "", payRateMax: "", payPeriod: "", payRateCurrency: "", additionalInfo: "", actionRequestedOfLp: "SUBMIT", rhInternalTrackingType: "", }; var newsApiObject = { recaptchaEnabled: "", invisibleRecaptchaToken: "", }; function scrollToTopOfForm() { const formContainer = document.querySelector(".form-container"); if (formContainer) { const topEl = formContainer .closest("rhcl-block-hero-form") ?.shadowRoot?.querySelector(".rhcl-block-hero-form__form"); const topOfForm = topEl?.getBoundingClientRect()?.top; const defaultHeaderHeight = 78; const headerHeight = parseInt( getComputedStyle(formContainer).getPropertyValue( "--rhcl-main-navigation-height" ), 10 ) || defaultHeaderHeight; if (top !== undefined) { setTimeout(() => { window.scrollTo({ top: topOfForm + window.scrollY - headerHeight, behavior: "smooth", }); }, 500); } } } function getURLParameters() { const urlSearchParams = new URLSearchParams(window.location.search); const params = Object.fromEntries(urlSearchParams.entries()); return params; } function getByPassStatus(params) { var arrayLength = params.length; for (var i = 0; i < arrayLength; i++) { if (params[i] === bypassPerimeter) { return 0; } } return 1; } function setKeyValueInUPO(key, unifiedProfileObject, value) { //set a particular key value in UPO unifiedProfileObject[key] = value; return unifiedProfileObject; } function saveGatingPropertyInUPO() { if (localStorage.getItem("unifiedProfileObject") != null) { var unifiedProfileObject = window.getUPO(); const gatingProperties = document.querySelector(".gating-properties"); if (gatingProperties != null) { var gatingProperty = gatingProperties.getAttribute("gatingproperty") != undefined ? gatingProperties.getAttribute("gatingproperty") : "sgGatingFormSubmitted"; unifiedProfileObject = setKeyValueInUPO( gatingProperty, unifiedProfileObject, window.salaryGuideGatingProperties.key ); window.setUPO(unifiedProfileObject); } } window.localStorage.setItem( "salaryGuideGatingKey", window.salaryGuideGatingProperties.key ); } var businessUnit = { us: "na", ca: "na", au: "iz_apac_sam", br: "iz_apac_sam", cl: "iz_apac_sam", cn: "iz_apac_sam", hk: "iz_apac_sam", jp: "iz_apac_sam", nz: "iz_apac_sam", sg: "iz_apac_sam", be: "iz_eu", ch: "iz_eu", de: "iz_eu", fr: "iz_eu", nl: "iz_eu", uk: "iz_eu", }; const removeTags = (str) => { if (str === null || str === "") { return false; } else { str = str.toString(); } // Regular expression to identify HTML tags in the input string. Replacing the identified HTML tag with a null string. str = str.replace(/(<([^>]+)>)/gi, ""); // Regular expression to identify enter in the input string. Replacing the identified enter with a null string. return (str = str.replace(/\r?\n|\r/g, "")); }; //Success handling for form submit redirect function handleShowRedirectStatusSuccess(form, thisInstance) { form.nextElementSibling.style.display = "none"; let thankYouPage = thisInstance .getAttribute("destination") .replace("/content/roberthalf", "") .replace(".html", ""); const redirectionUrl = window.localStorage.getItem("redirectionUrl"); if ( thankYouPage !== undefined && thankYouPage !== "" && thankYouPage != null ) { if (redirectionUrl) { if (thankYouPage.includes("html")) { thankYouPage = thankYouPage.split(".")[0]; thankYouPage += redirectionUrl + ".html"; } else { thankYouPage += redirectionUrl; } localStorage.removeItem("redirectionUrl"); } const timeout = thisInstance.getAttribute("data-redirect-delay") || 0; const target = thisInstance.getAttribute("data-redirect-target") || "_self"; if (target === "_self") { setTimeout(()=> { window.location.replace(thankYouPage); }, timeout); } else { window.open(thankYouPage, "_blank"); } } } //Success handling for email modal function handleEmailModalSuccess(form) { form.nextElementSibling.style.display = "none"; document.querySelector("#email-model").removeAttribute("show-modal"); if (document.querySelector("#thankyou-modal") !== null) { document .querySelector("#thankyou-modal") .setAttribute("show-modal", ""); let thankUName, thankUEmail; if (localStorage.getItem("unifiedProfileObject") != null) { thankUName = window.getUPO().firstName; thankUEmail = window.getUPO().emailAddress ? window.getUPO().emailAddress : window.getUPO().email; } let thankYouHeading = document.querySelector( "#thankyou-modal rhcl-heading" ); let thankYouEmail = document.querySelector( "#thankyou-modal rhcl-typography" ); if (thankYouHeading != null) { let thankYouName = document .querySelector("#thankyou-modal rhcl-heading") .getAttribute("data-attribute-heading"); thankYouName = thankYouName.replace("<>", thankUName); document.querySelector( "#thankyou-modal rhcl-heading" ).textContent = thankYouName; } if (thankYouEmail != null) { let thankYouEmail = document .querySelector("#thankyou-modal rhcl-typography") .getAttribute("data-attribute-disclaimer"); thankYouEmail = thankYouEmail.replace("<>", thankUEmail); document.querySelector( "#thankyou-modal rhcl-typography" ).textContent = thankYouEmail; } } } //Success handling for form submit popup message function handlePopupStatusSuccess(form, response){ form.nextElementSibling.style.display = "none"; const alertEl = document.querySelector( ".form-container rhcl-alert" ); const formContainer = document.querySelector(".form-container"); const formContentEls = document.querySelectorAll( '[slot="form-content"]' ); if (alertEl) { alertEl.style.display = "none"; } if (formContainer) { formContainer.style.display = "none"; } formContentEls.forEach((el) => { el.style.display = "flex"; el.style.justifyContent = "center"; el.style.flexWrap = "wrap"; }); let successMsg = response.hasOwnProperty("request_message") ? response.request_message : "The action was processed successfully."; successMsg = (document.querySelector("#showPopupStatus") && document.querySelector("#showPopupStatus").getAttribute("data-copy")) ? document .querySelector("#showPopupStatus") .getAttribute("data-copy") : successMsg; successMsg = (document.querySelector("#showRedirectAndPopupStatus") && document.querySelector("#showRedirectAndPopupStatus").getAttribute("data-copy")) ? document .querySelector("#showRedirectAndPopupStatus") .getAttribute("data-copy") : successMsg; successMsg = removeTags(successMsg); document .querySelectorAll('[slot="form-content"]') .forEach(function (element) { element.insertAdjacentHTML( "afterbegin", `<rhcl-typography tag='p' variant='body1'>${successMsg}</rhcl-typography>` ); }); scrollToTopOfForm(); } function ajaxCall(input, thisInstance, form) { let successRedirectStatus = false; let successPopupStatus = false; let successEmailModalStatus = false; const handleDataValidationFailed = (messageKey, message, form) => { if ( messageKey === "20_validationFailed_invisibleRecaptchaToken" || messageKey === "20_validationFailed_invisibleRecaptchaScore" ) { form.nextElementSibling.style.display = "none"; showInteractiveReCaptcha(); } else if ( messageKey === "20_validationFailed_interactiveRecaptchaToken" || messageKey === "20_validationFailed_interativeRecaptchaToken" ) { form.nextElementSibling.style.display = "none"; displayCustomAlert(message); } else if ( messageKey === "20_validationFailed_interactiveRecaptchaToken" || messageKey === "20_validationFailed_interativeRecaptchaToken" ) { form.nextElementSibling.style.display = "none"; displayCustomAlert(message); } else { cleanUpRecaptcha(); } }; const handleFormTypeAnalytics = () => { const formTypeVal = document.querySelector( ".rhformhiddenfield input[name=formType]" ); const projectTypeVal = document.querySelector( ".rhformhiddenfield input[name=projectType]" ); if (formTypeVal && requestData?.formType && formTypeVal.value !== requestData.formType) { formTypeVal.value = requestData.formType; } let analyticObj; //Single step job order form if (formTypeVal && formTypeVal.value === "job-order") { var industry = document.querySelector( "form rhcl-text-field[name=industry]" )?.value; analyticObj = { tealium_event: "job_order_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, indicator_remote: !!document .querySelector("rhcl-checkbox") ?.hasAttribute("selected"), industry: industry ? industry : "", job_id: document.querySelector("#sfJoNumber") ? document.querySelector("#sfJoNumber").getAttribute("value") : "", job_type: window.getUPO().employmentType, job_title: window.getUPO().positionTitle, lob: document.querySelector("#lob") ? document.querySelector("#lob").getAttribute("value") : "", location: window.getUPO().postalCode, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //Executive Search form if (formTypeVal && formTypeVal.value === "executive-search") { analyticObj = { tealium_event: "job_order_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), event_version: "executive search", form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, job_title: window.getUPO().positionTitle, location: window.getUPO().postalCode, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //Newsletter subscription form if (formTypeVal && formTypeVal.value === "newsletter-subscription") { analyticObj = { tealium_event: "newsletter_subscription_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //Salary guide form if (formTypeVal && formTypeVal.value === "salary-guide") { let userType = ""; let checkBoxVal = document.querySelector("form rhcl-radio-group") ? document.querySelector("form rhcl-radio-group").value : ""; if (checkBoxVal === "yes") { userType = "client"; } else if (checkBoxVal === "no") { userType = "candidate"; } analyticObj = { tealium_event: "salary_guide_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, form_type: formTypeVal.value, user_type: userType, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //webmaster feedback form if (formTypeVal && formTypeVal.value === "webmaster-feedback") { analyticObj = { tealium_event: "feedback_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_type: formTypeVal.value, }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); console.log(analyticObj, "event"); } //client visit form if (formTypeVal && formTypeVal.value === "client-visit") { analyticObj = { tealium_event: "client_visit_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), event_version: projectTypeVal.value, form_type: formTypeVal.value, form_name: formTypeVal.name, form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, page_name: "", page_section: "", user_focus: "", user_state: window.getUPO().isLoggedIn ? "auth" : "unauth", }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } //gated form if (formTypeVal && formTypeVal.value === "gated") { let visitorTypeValue = requestData.visitorType || document.querySelector( "form rhcl-radio-group[name='visitorType']" )?.value || ""; if ( visitorTypeValue === "" && document.getElementsByName("visitorType").length ) { visitorTypeValue = document.getElementsByName("visitorType")[0]?.value; } analyticObj = { tealium_event: "gated_submit", datalayer_version: 2, event_attr_01: visitorTypeValue, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), event_version: projectTypeVal.value, form_type: formTypeVal.value, form_name: formTypeVal.name, form_email: window.getUPO().email ? window.getUPO().email : window.getUPO().candidateEmail, page_name: "", page_section: "", user_focus: "", user_state: window.getUPO().isLoggedIn ? "auth" : "unauth", }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); console.log(analyticObj, "event"); } //job order forms if ( formTypeVal && (formTypeVal.value === "job-order-no-rhd" || formTypeVal.value === "job-order-one-click") ) { analyticObj = { tealium_event: "job_order_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_type: formTypeVal.value, }; const hasEmail = Array.from( document.querySelectorAll("form rhcl-text-field") ).filter((ele) => { return ele.type === "email"; }); if (hasEmail.length) analyticObj["form_email"] = hasEmail[0].value; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } if ( formTypeVal && (formTypeVal.value === "candidate-referral" || formTypeVal.value === "email-us" || formTypeVal.value === "job-order-no-rhd" || formTypeVal.value === "job-order-one-click" || formTypeVal.value === "mobile-app-download" || formTypeVal.value === "candidate-work-history" || formTypeVal.value === "contact-us-aws" || formTypeVal.value === "contact-us") ) { analyticObj = { tealium_event: "form_submit", datalayer_version: 2, event_action: "rhcl-button-clicked", event_text: document .querySelector("form rhcl-button") .getAttribute("component-tracking-label"), form_type: formTypeVal.value, }; const hasEmail = Array.from( document.querySelectorAll("form rhcl-text-field") ).filter((ele) => { return ele.type === "email"; }); if (hasEmail.length) analyticObj["form_email"] = hasEmail[0].value; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } rh_datalayer_add(analyticObj, "event"); } if (document.querySelector(".salary-guide") !== null) { form.nextElementSibling.style.display = "none"; saveGatingPropertyInUPO(); } } const displayCustomAlert = (message) => { const alertElement = document.querySelector(".form-container rhcl-alert:first"); alertElement.setAttribute("copy", message); alertElement.style.display = "block"; setTimeout(() => { const formContainer = document.querySelector(".form-container"); window.scrollTo({ top: formContainer.getBoundingClientRect() + formContainer.ownerDocument.defaultView.scrollY, behavior: "smooth", }); }, 500); }; const displayErrorMessage = (status, form) => { form.nextElementSibling.style.display = "none"; const alertEl = document.querySelector( ".form-container rhcl-alert[data-status='" + status + "']" ); if (alertEl) { alertEl.style.display = "block"; } scrollToTopOfForm(); } const displayDynamicErrorMessage = (fieldName) => { const fieldEl = document.querySelector(`.form-container *[name='${fieldName}']`); let errorMessage = fieldEl?.getAttribute("error-message-lp"); if (errorMessage && errorMessage.includes(fieldName)) { errorMessage = errorMessage.replace( `{${fieldName}}`, leadApiRequestObject[fieldName] ); } if (errorMessage && fieldEl) { fieldEl.customErrorMessage = errorMessage; fieldEl.customInvalid = true; } } const handleSuccessResponse = (response) => { // successful form submission event for adobe target (BOBA-5836) if (response?.requestMessageKey === "20_success" && !response?.request_message?.endsWith("#")) { const submissionEvent = new Event("formSubmittedSuccessfully"); document.dispatchEvent(submissionEvent); } if (successPopupStatus) handlePopupStatusSuccess(form, response); if (successEmailModalStatus) handleEmailModalSuccess(form); if (successRedirectStatus) handleShowRedirectStatusSuccess(form, thisInstance); } const handleErrorResponse = (response) => { const { status, request_message_Key } = response; if ([500, 502, 503, 504, "error"].includes(status)) { displayErrorMessage(status, form); return; } if (request_message_Key) { form.nextElementSibling.style.display = "none"; if (request_message_Key.length > 0) { if (request_message_Key.includes("20_validationFailed_postalCode")) { displayDynamicErrorMessage("postalCode"); } if (request_message_Key.includes("20_validationFailed_positionTitle")) { displayDynamicErrorMessage("positionTitle"); } scrollToTopOfForm(); } } handleDataValidationFailed(response, request_message_Key, form); } const cleanUpRecaptcha = () => { const recaptchaContainer = document.getElementById("grecaptcha-interactive"); if (recaptchaContainer) recaptchaContainer.remove(); recaptchaFlag = 0; delete leadApiRequestObject?.interactiveRecaptchaToken; delete candidateWorkHistory?.interactiveRecaptchaToken; delete newsApiObject?.interactiveRecaptchaToken; }; //Run POST fetch for all form requests const handleAllFetches = () => { const fetchWithRetry = (url, requestData, type, retries = 3) => { return fetch(url, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(requestData), }) .then((response) => { if (response.ok) { return response.json().then((data) => ({response, status: response.status, data, type})); } else if (retries > 0) { return fetchWithRetry(url, requestData, type, retries - 1); } else { console.log(`Max retries for the following submission endpoint: ${url}`); return { status: "error", data: null, error: "Max retries reached" }; } }) .catch((error) => { console.error(`Fetch error for ${url}:`, error); return { status: "error", data: null, error }; }); }; //Create each fetch request with specific payload for each request type (leads, nonleads,jobalerts) const fetchRequests = formActionUrlIterable.map(([type, url]) => { requestData = createRequestPayload(input, thisInstance, type); return fetchWithRetry(url, requestData, type); }); //Collect responses and handle responses for the POST request(s). Promise.all(fetchRequests) .then((responses) => { let fetchFailList = []; let fetchSuccessList = []; responses.forEach(({ response, status, data , type}) => { const requestMessageKey = data.request_message_key || data.request_message_Key; const requestMessage = data.request_message; if ((status === 200 || status === 202) && requestMessageKey === "20_success") { // Handle success paths if (document.querySelector("#showRedirectStatus")) { successRedirectStatus = true; } if (document.querySelector("#showRedirectAndPopupStatus")) { successRedirectStatus = true; successPopupStatus = true; } if (document.querySelector("#showPopupStatus")) { successPopupStatus = true; } if (document.querySelector("#email-model")) { successEmailModalStatus = true; } fetchSuccessList.push( { "type": type, "response": data } ) } else { fetchFailList.push( { "type": type, "response": data } ) handleDataValidationFailed( requestMessageKey, requestMessage, form); } }); if (fetchFailList.length > 0) { const hasFailMarketing = fetchFailList.some(item => item.type === "nonLeads"); const hasSuccessLeads = fetchSuccessList.some(item => item.type === "leads"); //In scenario where leads AND nonleads are called we set success if leads is the only successful call if (hasFailMarketing && hasSuccessLeads) { if (typeof fetchSuccessList[0].response.request_message_Key !== "string" && fetchSuccessList[0].response.request_message_Key !== "20_success" ) { return; } handleSuccessResponse(fetchSuccessList[0].response); } else { handleErrorResponse(fetchFailList[0].response, form); } } else { // Handle each success scenarios after all responses are processed handleSuccessResponse(fetchSuccessList[0].response); } handleFormTypeAnalytics(); }) .catch((error) => { console.error("Error handling fetch requests:", error); displayErrorMessage("error", form); }); }; handleAllFetches(); } window.ready(function () { document .querySelectorAll(".form-submit-btn rhcl-button") .forEach(function (el) { el.addEventListener("click", function (e) { e.preventDefault(); recaptchaStatus(); getLeadId(); setTimeout(getSubmissionDate, 2000); let thisInstance = this; let form = this.closest("form"); if (!form.closest(".salary-guide")) { localStorage.removeItem("redirectionUrl"); } var inputElements = form.querySelectorAll("[rhcl-input]"); var dateElements = form.querySelectorAll("rhcl-datepicker"); let validateFieldArray = [...inputElements, ...dateElements]; setFormActionUrls(); validateForm(validateFieldArray, thisInstance, form); if (document.querySelectorAll(".salary-guide").length > 0) { updateHiddenFields(); } }); }); document.querySelectorAll(".form-btn rhcl-button").forEach(function (el) { el.addEventListener("click", function (e) { e.preventDefault(); const thisInstance = this; var form = document.querySelector(".form-btn") ? document.querySelector(".form-btn").closest("form") : null; var inputElements = form ? form.querySelectorAll("[rhcl-input]") : []; let validateFieldArray = Array.from(inputElements); setFormActionUrls(); validateForm(validateFieldArray, thisInstance, form); recaptchaStatus(); }); }); }); function getPostalCodeInForm() { return document.querySelector("rhcl-text-field[name='postalCode']"); } function setFormActionUrls() { const formActionUrls = document.querySelector(".form-btn") ? document.querySelector(".form-btn").closest("form").getAttribute("data-attribute-endpoints") : document .querySelector(".form-submit-btn") .closest("form") .getAttribute("data-attribute-endpoints"); const formActionUrlMap = JSON.parse(formActionUrls); formActionUrlIterable = Object.entries(formActionUrlMap); } function isCountryUS() { var country = document.getElementById("country"); return country && country.hasAttribute("value") && country.value === "US"; } function isPostalCodeInvalidForUS(value) { return ( value.match(/^(82[0-9]{3}|83[0-3][0-9]{2}|8341[0-4])$/) || value.match( /^(995[0-9]{2}|996[0-9]{2}|997[0-9]{2}|998[0-9]{2}|999[0-4][0-9]|99950)$/ ) || value.match( /^(24[7-9][0-9]{2}|25[0-9]{3}|26[0-7][0-9]{2}|268[0-7][0-9]|2688[0-6])$/ ) ); } function getPostalCodeErrorValidity() { var postalCodeField = getPostalCodeInForm(); var value = postalCodeField.value; if (!postalCode || !isCountryUS()) { return false; } const isInvalid = isPostalCodeInvalidForUS(value); var initialMessage = postalCodeField.getAttribute("custom-error-message"); if (isInvalid) { initialMessage = `Robert Half cannot support staffing needs in ${value} at this time.`; postalCodeField.setAttribute("custom-invalid", ""); postalCodeField.setAttribute("custom-error-message", initialMessage); } else { postalCodeField.removeAttribute("custom-invalid"); postalCodeField.removeAttribute("custom-error-message"); } return isInvalid; } var postalCode = getPostalCodeInForm(); if (postalCode) { postalCode.addEventListener("rhcl-text-field-blur", function (e) { if (isCountryUS()) { let isValid = true; const promises = []; postalCode.removeAttribute("custom-invalid"); postalCode.customInvalid = null; promises.push(postalCode.validate()); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { getPostalCodeErrorValidity(); } }); } }); if ( getURLParameter("postalCode") != "" || getURLParameter("postalCode") != null || getURLParameter("postalCode") != undefined ) { var postalCodecount = 0; document .querySelector(".form-container rhcl-text-field[name='postalCode']") .addEventListener("rhcl-text-field-changed", function (e) { var patternId = document.querySelector("#rhFormTextField"); var pattern = ""; var patternMessage = ""; if (patternId) { pattern = patternId.hasAttribute("data-pattern") ? patternId.getAttribute("data-pattern") : ""; patternMessage = patternId.hasAttribute("data-errorMessage") ? patternId.getAttribute("data-errorMessage") : ""; } let isValid = true; const promises = []; document .querySelector("rhcl-text-field[name='postalCode']") .removeAttribute("custom-invalid"); document.querySelector( "rhcl-text-field[name='postalCode']" ).customInvalid = null; promises.push( document .querySelector("rhcl-text-field[name='postalCode']") .validate() ); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { postalCodecount += 1; if (postalCodecount < 2 && this.value) { const value = this.value; if (pattern && value.match(pattern) === null) { this.setAttribute("custom-invalid", ""); } else { this.removeAttribute("custom-invalid"); } this.setAttribute("custom-error-message", patternMessage); } } }); }); } } function getEmailField() { return document.querySelector('[id^="rhcl-text-field"][type="email"]'); } if ( document.querySelector("rhcl-datepicker[name='startDate']") && document.querySelector("rhcl-datepicker[name='endDate']") ) { document .querySelector("rhcl-datepicker[name='endDate']") .addEventListener("rhcl-calendar-change", (e) => { let isValid = true; const promises = []; document .querySelector("rhcl-datepicker[name='endDate']") .removeAttribute("custom-invalid"); document.querySelector("rhcl-datepicker[name='endDate']").customInvalid = null; document .querySelector("rhcl-datepicker[name='endDate']") .labelRef.removeAttribute("custom-invalid"); promises.push( document.querySelector("rhcl-datepicker[name='endDate']").validate() ); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { const formName = document.querySelector( "input[name='formName']" ).value; if (formName && formName.includes("candidate_work_history")) { const startDate = document.querySelector( "rhcl-datepicker[name='startDate']" ); const endDate = document.querySelector( "rhcl-datepicker[name='endDate']" ); const errorMsg = endDate.hasAttribute("data-custom-error-message") ? endDate.getAttribute("data-custom-error-message") : ""; var initialMessage = endDate.getAttribute("custom-error-message"); endDate.removeAttribute("custom-invalid"); endDate.labelRef.removeAttribute("custom-invalid"); var flag = 0; if (new Date(startDate.value) >= new Date(endDate.value)) { flag = 1; if (errorMsg) { initialMessage = errorMsg; } else { initialMessage = "Start Date can not be greater than End Date"; } } if (flag === 1) { endDate.setAttribute("custom-invalid", ""); endDate.labelRef.setAttribute("custom-invalid", ""); } else { endDate.removeAttribute("custom-invalid"); endDate.labelRef.removeAttribute("custom-invalid"); } endDate.setAttribute("custom-error-message", initialMessage); } } }); }); document .querySelector("rhcl-datepicker[name='startDate']") .addEventListener("rhcl-calendar-change", (e) => { let isValid = true; const promises = []; if (document.querySelector("rhcl-datepicker[name='endDate']").value) { document .querySelector("rhcl-datepicker[name='endDate']") .removeAttribute("custom-invalid"); document.querySelector( "rhcl-datepicker[name='endDate']" ).customInvalid = null; document .querySelector("rhcl-datepicker[name='endDate']") .labelRef.removeAttribute("custom-invalid"); promises.push( document.querySelector("rhcl-datepicker[name='endDate']").validate() ); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { var startDate = document.querySelector( "rhcl-datepicker[name='startDate']" ); var endDate = document.querySelector( "rhcl-datepicker[name='endDate']" ); const errorMsg = endDate.hasAttribute("data-custom-error-message") ? endDate.getAttribute("data-custom-error-message") : ""; var initialMessage = endDate.getAttribute("custom-error-message"); endDate.removeAttribute("custome-invalid"); endDate.labelRef.setAttribute("custom-invalid", ""); var flag = 0; if ( endDate.value && new Date(startDate.value) > new Date(endDate.value) ) { flag = 1; if (errorMsg) { initialMessage = errorMsg; } else { initialMessage = "Start Date can not be greater than End Date"; } } if (flag === 1) { endDate.setAttribute("custom-invalid", ""); endDate.labelRef.setAttribute("custom-invalid", ""); } else { endDate.removeAttribute("custom-invalid"); endDate.labelRef.removeAttribute("custom-invalid"); } endDate.setAttribute("custom-error-message", initialMessage); } }); } }); } if (document.querySelector("rhcl-checkbox[name='currentEmployer']")) { document .querySelector("rhcl-checkbox[name='currentEmployer']") .addEventListener("rhcl-checkbox-changed", () => { const formName = document.querySelector("input[name='formName']").value; if (formName && formName.includes("candidate_work_history")) { const currEmp = document.querySelector( "rhcl-checkbox[name='currentEmployer']" ).selected; const endDate = document.querySelector( "rhcl-datepicker[name='endDate']" ); if (currEmp && endDate) { endDate.setAttribute("disabled", ""); endDate.setAttribute("date", ""); endDate.style.pointerEvents = "none"; endDate.style.opacity = 0.6; endDate.hasAttribute("custom-invalid") ? endDate.removeAttribute("custom-invalid") : ""; } else { endDate.removeAttribute("disabled"); endDate.style.pointerEvents = "unset"; endDate.style.opacity = 1; } } }); } function updateHiddenFields() { var pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); var country = pagePath.split("/")[1]; var language = pagePath.split("/")[2]; if ( businessUnit.hasOwnProperty(country) && country != undefined && language != undefined ) { var formName = "form_" + businessUnit[country] + "_" + country + "_" + language + "_salary_guide_gating"; if (document.querySelector("input[name='formName']") != null) { document.querySelector("input[name='formName']").value = formName; } if (document.querySelector("input[name='language']") != null) { document.querySelector("input[name='language']").value = language.toUpperCase(); } if (document.querySelector("input[name='countryCode']") != null) { document.querySelector("input[name='countryCode']").value = country.toUpperCase(); } if (document.querySelector("input[name='salaryGuideYear']") != null) { document.querySelector("input[name='salaryGuideYear']").value = new Date().getFullYear(); } } } function createRequestPayload(input, thisInstance, endpointType) { let unifiedProfileObject; var hiddenInput = thisInstance .closest("form") .querySelectorAll("input[type=hidden]"); var dates = document.querySelectorAll("form rhcl-datepicker"); if (localStorage.getItem("unifiedProfileObject") != null) { unifiedProfileObject = window.getUPO(); } const inputArray = [...input, ...hiddenInput, ...dates]; if ( endpointType === "jobAlerts" ) { let inputValues = { searchTerms: "", emailAddress: "", location: "", country: "", language: "", }; for (const element in inputArray) { inputValues = retrieveJobAlertsInputFields( inputArray[element], inputValues ); } updateJobAlertDetails(inputValues); return jobAlertRequestObject; } else { for (const element in inputArray) { if ( inputArray[element].tagName.toLocaleLowerCase() != "rhcl-checkbox" && inputArray[element].tagName.toLocaleLowerCase() != "rhcl-radio" && inputArray[element].tagName.toLocaleLowerCase() != "rhcl-datepicker" ) { if (inputArray[element].value != undefined) { var noStringsInput = inputArray[element].value.replace(/["']/g, ""); leadApiRequestObject[inputArray[element].name] = noStringsInput; if ( document.querySelector("[data-attribute-iz]") != null && inputArray[element].tagName.toLocaleLowerCase() === "rhcl-radio-group" ) { if (inputArray[element].value.toLocaleLowerCase() === "client") { newsApiObject["newsClient"] = "True"; newsApiObject["newsCandidate"] = "False"; } else if ( inputArray[element].value.toLocaleLowerCase() === "candidate" ) { newsApiObject["newsClient"] = "False"; newsApiObject["newsCandidate"] = "True"; } } else { newsApiObject[inputArray[element].name] = inputArray[element].value; candidateWorkHistory[inputArray[element].name] = inputArray[element].value; } if (unifiedProfileObject != null) { if (inputArray[element].name in unifiedProfileObject) { if (inputArray[element].name === "email") { unifiedProfileObject["emailAddress"] = inputArray[element].value; } else if (inputArray[element].name === "emailAddress") { unifiedProfileObject["email"] = inputArray[element].value; } else if (inputArray[element].name === "fullName") { unifiedProfileObject["fullName"] = inputArray[element].value; } else if (inputArray[element].name === "officeInfo") { unifiedProfileObject["officeInfo"] = inputArray[element].value; } else if (inputArray[element].name === "businessPhone") { unifiedProfileObject["businessPhone"] = inputArray[element].value; } unifiedProfileObject[inputArray[element].name] = inputArray[element].value; if ( unifiedProfileObject.peopleNumber != "" && endpointType === "leads" ) { leadApiRequestObject["peopleNumber"] = unifiedProfileObject.peopleNumber; } if (unifiedProfileObject.contactSfID != "") { newsApiObject["sfContactID"] = unifiedProfileObject.contactSfID; } } if (unifiedProfileObject.contactSfID != "") { candidateWorkHistory["subscriberKey"] = unifiedProfileObject.contactSfID; } } if ( !leadApiRequestObject.rhInternalTrackingType || leadApiRequestObject.rhInternalTrackingType === "Not found" ) { // if the tracking type isn't already set by an ad campaign url leadApiRequestObject["rhInternalTrackingType"] = unifiedProfileObject.isLoggedIn ? "LUX" : "RH Website Visitor"; } } } if ( inputArray[element].tagName.toLocaleLowerCase() === "rhcl-datepicker" ) { if (inputArray[element].value === "") { candidateWorkHistory[inputArray[element].name] = ""; } else { candidateWorkHistory[inputArray[element].name] = changeDateFormat( inputArray[element].value ); } } } var radioValue = document.querySelectorAll("form rhcl-radio:checked"); if (radioValue != null) { radioValue.forEach(function (element) { leadApiRequestObject[element.name] = element.value; newsApiObject[element.name] = element.value; candidateWorkHistory[element.name] = element.value; if (unifiedProfileObject != null) { if (element.name in unifiedProfileObject) { unifiedProfileObject[element.name] = element.value; } } }); } if ( document.querySelectorAll("[data-attribute-iz]").length > 0 && "radioButton" in newsApiObject ) { delete newsApiObject.radioButton; } if ( document.querySelectorAll("[data-attribute-iz]").length > 0 && "radioButtons" in newsApiObject ) { delete newsApiObject.radioButtons; } if ("formType" in newsApiObject) { delete newsApiObject.formType; } var checkboxValue = document.querySelectorAll("form rhcl-checkbox"); if (checkboxValue.length > 0) { checkboxValue.forEach(function (element) { if (element.selected === true) { if (element.name != null) { leadApiRequestObject[element.name] = element.value || "true"; newsApiObject[element.name] = element.value || "true"; candidateWorkHistory[element.name] = element.value || "true"; if (unifiedProfileObject != null) { if (element.name in unifiedProfileObject) { unifiedProfileObject[element.name] = element.value || "true"; } } } } else { if (leadApiRequestObject.hasOwnProperty(element.name)) { delete leadApiRequestObject[element.name]; } leadApiRequestObject[element.name] = "false"; newsApiObject[element.name] = element.value || "false"; candidateWorkHistory[element.name] = element.value || "false"; } }); } if (unifiedProfileObject != null) { window.setUPO(unifiedProfileObject); } if (document.querySelectorAll(".form-btn").length > 0) { return newsApiObject; } if ( document.querySelectorAll("input[name='formName']").length > 0 && document.querySelectorAll("input[name='formName']").value === "form_na_candidate_work_history" ) { return candidateWorkHistory; } return leadApiRequestObject; } function changeDateFormat(inputDate) { if (inputDate) { var splitDate = inputDate.split("-"); if (splitDate.count === 0) { return null; } var year = splitDate[0]; var month = splitDate[1]; var day = splitDate[2]; return month + "-" + day + "-" + year; } else { return ""; } } function retrieveJobAlertsInputFields(inputElement, inputValues) { if (inputElement.name === null) { return inputValues; } if (inputElement.name.toLocaleLowerCase() === "searchterms") { inputValues.searchTerms = inputElement.value || ""; } if (inputElement.name.toLocaleLowerCase() === "email") { inputValues.emailAddress = inputElement.value || ""; } if (inputElement.name.toLocaleLowerCase() === "location") { inputValues.location = inputElement.value || ""; } return inputValues; } function updateJobAlertDetails(inputValues) { let pagePath = new URL(window.location); pagePath = pagePath.pathname.replace("/content/roberthalf", ""); if (pagePath) { inputValues.country = pagePath.split("/")[1]; inputValues.language = pagePath.split("/")[2]; } jobAlertRequestObject.candidateEmailAddress = inputValues.emailAddress; jobAlertRequestObject.keywords = inputValues.searchTerms; jobAlertRequestObject.keywordsNoSpaces = inputValues.searchTerms.replace( /\s+/g, "" ); jobAlertRequestObject.location = inputValues.location; jobAlertRequestObject.locationNoSpaces = inputValues.location.replace( /\s+/g, "" ); jobAlertRequestObject.locale = inputValues.language.toLowerCase() + "_" + inputValues.country.toUpperCase(); jobAlertRequestObject.countryCode = inputValues.country.toLowerCase(); jobAlertRequestObject.insrtDttmHist = new Date().toISOString(); jobAlertRequestObject.subscriptionSourceUrl = window.location.href; jobAlertRequestObject.searchResultsUrl = window.location.origin + "/" + inputValues.country.toLowerCase() + "/" + inputValues.language.toLowerCase() + "/jobs/" + inputValues.location.replace(/ /g, "-") + "/" + encodeURIComponent(inputValues.searchTerms); const randomString = Math.random().toString(36).slice(2, 12); const timestamp = Date.now().toString().slice(-10); jobAlertRequestObject.jobAlertsSubscriptionId = `${randomString}_${timestamp}`; } } window.verifyCallback = function verifyCallback(response) { recaptchaFlag = 1; leadApiRequestObject["interactiveRecaptchaToken"] = response; candidateWorkHistory["interactiveRecaptchaToken"] = response; newsApiObject["interactiveRecaptchaToken"] = response; if (leadApiRequestObject.hasOwnProperty("invisibleRecaptchaToken")) { delete leadApiRequestObject.invisibleRecaptchaToken; } if (candidateWorkHistory.hasOwnProperty("invisibleRecaptchaToken")) { delete candidateWorkHistory.invisibleRecaptchaToken; } if (newsApiObject.hasOwnProperty("invisibleRecaptchaToken")) { delete newsApiObject.invisibleRecaptchaToken; } }; function showInteractiveReCaptcha() { recaptchaFlag = 1; var key = document.querySelectorAll(".form-btn").length > 0 ? document .querySelector(".form-btn rhcl-button") .getAttribute("interactive-key") : document .querySelector(".form-submit-btn rhcl-button") .getAttribute("interactive-key"); // Create the interactive reCAPTCHA HTML var recaptchaContainer = document.createElement("span"); recaptchaContainer.id = "grecaptcha-interactive"; recaptchaContainer.className = "g-recaptcha"; recaptchaContainer.setAttribute("data-sitekey", key); recaptchaContainer.setAttribute("data-callback", "verifyCallback"); recaptchaContainer.setAttribute("theme", "light"); var formGeneral = document.querySelector(".form-submit-btn"); var formNews = document.querySelector(".form-btn"); if (formGeneral != null) { document .querySelector(".form-submit-btn") .insertBefore( recaptchaContainer, document.querySelector(".form-submit-btn").firstChild ); } if (formNews != null) { document .querySelector(".form-btn") .insertBefore( recaptchaContainer, document.querySelector(".form-btn").firstChild ); } // Render the interactive reCAPTCHA grecaptcha.render(recaptchaContainer, { sitekey: key, }); //ajax call in which we will get the score //passes } function validateRecaptcha(input, thisInstance, form) { var key = document.querySelectorAll(".form-btn").length > 0 ? document .querySelector(".form-btn rhcl-button") .getAttribute("invisible-key") : document .querySelector(".form-submit-btn rhcl-button") .getAttribute("invisible-key"); grecaptcha.enterprise.ready(function () { grecaptcha.enterprise .execute(key, { action: "click", }) .then(function (token) { leadApiRequestObject["invisibleRecaptchaToken"] = token; candidateWorkHistory["invisibleRecaptchaToken"] = token; newsApiObject["invisibleRecaptchaToken"] = token; ajaxCall(input, thisInstance, form); }); }); } async function validateForm(input, thisInstance, form) { let isValid = true; const fieldsToValidate = input; const promises = []; var flag = 1; fieldsToValidate.forEach((elem) => { if ( typeof elem.validate === "function" && !elem.getAttribute("form-submission-hidden") ) { promises.push(elem.validate()); } }); // wait for all promises to be finished await Promise.allSettled(promises).then(async (results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); const parameters = getURLParameters(); var params = Object.keys(parameters); flag = getByPassStatus(params); var postalCode = getPostalCodeInForm(); if (isValid && postalCode && isCountryUS()) { const isPostalCodeInvalid = getPostalCodeErrorValidity(); if (isPostalCodeInvalid) { isValid = false; } } // getEmailField and email valid functions are written in emailValidation.html file. var emailField = getEmailField(); if ( isValid && emailField ) { //If leads Submission we want to force validation on email field let isLeadsSubmission = false; //check if form is set to submit with leads endpoint formActionUrlIterable.forEach(([key]) => { if (key === "leads") { isLeadsSubmission = true; } }); //here we will make the call to validate email field if the field is // authored for validation or the submission is to leads if ( window.shouldCheckEmailValidation && typeof window.shouldCheckEmailValidation === "function" && shouldCheckEmailValidation(emailField.value, isLeadsSubmission) ) { emailField.removeAttribute("custom-invalid"); emailField.customInvalid = null; const isEmailCustomValid = checkEmailValidityForCustomDomains( emailField.value ); if (!isEmailCustomValid) { isValid = false; } setEmailCustomErrorMessage(isLeadsSubmission); if (isValid) { // check email for candidate restricted emails document.querySelector("#backdrop").style.display = "block"; await window.ssjoCandidateEmailCheck(isLeadsSubmission); document.querySelector("#backdrop").style.display = "none"; if (emailField.customInvalid) { isValid = false; } } } } if (isValid) { form.nextElementSibling.style.display = "block"; if (test && flag) { if (recaptchaFlag === 0) { validateRecaptcha(input, thisInstance, form); } else ajaxCall(input, thisInstance, form); } if (!test && !flag) { ajaxCall(input, thisInstance, form); } if (test && !flag) { ajaxCall(input, thisInstance, form); } if (!test && flag) { ajaxCall(input, thisInstance, form); } } }); } function recaptchaStatus() { var flag = 1; const parameters = getURLParameters(); var params = Object.keys(parameters); flag = getByPassStatus(params); if (test) { leadApiRequestObject["recaptchaEnabled"] = "true"; newsApiObject["recaptchaEnabled"] = "true"; candidateWorkHistory["recaptchaEnabled"] = "true"; } else { leadApiRequestObject["recaptchaEnabled"] = "false"; newsApiObject["recaptchaEnabled"] = "false"; candidateWorkHistory["recaptchaEnabled"] = "false"; } if (!flag) { leadApiRequestObject["recaptchaEnabled"] = "false"; leadApiRequestObject[bypassPerimeter] = parameters[bypassPerimeter]; newsApiObject["recaptchaEnabled"] = "false"; newsApiObject[bypassPerimeter] = parameters[bypassPerimeter]; candidateWorkHistory["recaptchaEnabled"] = "false"; candidateWorkHistory[bypassPerimeter] = parameters[bypassPerimeter]; } } function getLeadId() { if (document.querySelector("#leadId") != null) { var leadId = crypto.randomUUID(); var leadIdArray = [...document.querySelectorAll("#leadId")]; leadIdArray.forEach(function (ele) { ele.value = "rhwebsite_" + leadId; }); } } /*************************** Salary Guide Gating Logic*********************************************/ window.ready(function () { if (document.querySelector(".salary-guide") != null) { var currentUrl = new URL(window.location); if (currentUrl.pathname.includes(".html")) { var urlString = currentUrl.pathname.split("."); currentUrl = urlString[0]; } else { currentUrl = currentUrl.pathname; } if ( currentUrl.endsWith("salary-guide") || currentUrl.endsWith("guide-salarial") || currentUrl.endsWith("gehaltsuebersicht") || currentUrl.endsWith("salarisgids") || currentUrl.endsWith("guide-des-salaires") || currentUrl.endsWith("guia-salarial") ) { if (localStorage.getItem("unifiedProfileObject") != null) { var upo = window.getUPO(); var cookie = getCookie("wcmmode"); const gatingPropertyEl = document.querySelector(".gating-properties"); if (gatingPropertyEl != null && cookie != "edit") { var gatingproperty = gatingPropertyEl.getAttribute("gatingproperty") !== undefined ? gatingPropertyEl.getAttribute("gatingproperty") : "sgGatingFormSubmitted"; if (upo.hasOwnProperty(gatingproperty)) { var redirecturl = gatingPropertyEl.getAttribute("gatedredirect") != undefined ? gatingPropertyEl.getAttribute("gatedredirect") : ""; if (redirecturl != "") { window.location.replace(redirecturl); } } } } } } }); function checkQueryString(field) { var url = window.location.href; if (url.indexOf("?" + field + "=") != -1) { return true; } else if (url.indexOf("&" + field + "=") != -1) { return true; } return false; } function getURLParameter(sParam) { var sPageURL = new URL(window.location); sPageURL = sPageURL.search.substring(1); var sURLVariables = sPageURL.split("&"); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split("="); if (sParameterName[0] === sParam) { return sParameterName[1]; } } } //current date and time in format YYYY-MM-DD HH:MM:SS function currentDateTime() { var d = new Date(); d = d.getFullYear() + "-" + (d.getMonth() + 1 < 10 ? "0" + (d.getMonth() + 1) : d.getMonth() + 1) + "-" + (d.getDate() < 10 ? "0" + d.getDate() : d.getDate()) + " " + (d.getHours() < 10 ? "0" + d.getHours() : d.getHours()) + ":" + (d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes()) + ":" + (d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds()); return d; } function getSubmissionDate() { if (document.querySelector("#submissionDateTime") != null) { document.querySelector("#submissionDateTime").value = currentDateTime(); } if (document.querySelector("#submissionDate") != null) { document.querySelector("#submissionDate").value = currentDateTime(); } } window.ready(function () { /***************************on focus analytics*********************************************/ var refreshCount = 0; document.querySelector(".form-container [rhcl-input][required]") && document .querySelector(".form-container [rhcl-input][required]") .addEventListener("focus", () => { refreshCount += 1; var formTypeVal = document.querySelector( ".rhformhiddenfield input[name=formType]" ); var analyticObj = { tealium_event: "focus_click", datalayer_version: 2, event_action: "focus", event_text: document .querySelector(".form-container [rhcl-input][required]") .getAttribute("name"), form_type: formTypeVal?.value ? formTypeVal?.value : "", }; if (window.getUPO().isLoggedIn) { analyticObj["user_id_sfc"] = window.getUPO().contactSfID ? window.getUPO().contactSfID : ""; } if (refreshCount < 2) { rh_datalayer_add(analyticObj, "event"); } }); }); }()) </script> <!-- Conditional form routing data --> <form class="form-container"> <span type="hidden" id="bypassToken" name="bypassToken" value="bypassToken"></span> <rhcl-alert hidden data-status="500" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="502" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="503" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="504" copy="Our system temporarily timed out. Please try again in a few minutes or contact us if the issue persists." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="error" headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="positionTitleError" copy="Sorry, we don’t staff the role of {positionTitle} at this time." headline="Error!"></rhcl-alert> <rhcl-alert hidden data-status="postalCodeError" copy="Robert Half cannot support staffing needs in {postalCode} at this time." headline="Error!"></rhcl-alert> <div class="root container-fluid cmp-container"> <div class="form-field-set row"> <div class="field-set-header"> <rhcl-heading modifier="" tag="h2" theme="" variant="display5"></rhcl-heading> </div> <div class="field-element-row col-md-12"> <div class="row"> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <rhcl-text-field id="rhcl-text-field-1385148703" label="First Name" type="text" required max-length="25" min-length="2" min-length-message="First name must have at least 2 characters" max-length-message="First name cannot be longer than 25 characters" pattern="[a-zA-Z]+(?:(?:\. |[\-' ])[a-zA-Z]+)*" error-message="First name is required" format-message="Please enter a valid First Name" size="small" theme="concrete" name="firstName"> </rhcl-text-field> <script> var element = document.getElementById("rhcl-text-field-1385148703"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <rhcl-text-field id="rhcl-text-field-2085585652" label="Last Name" type="text" required max-length="40" min-length="2" min-length-message="Last name must have at least 2 characters" max-length-message="Last name cannot be longer than 40 characters" pattern="[a-zA-Z]+(?:(?:\. |[\-' ])[a-zA-Z]+)*" error-message="Last name is required" format-message="Please enter a valid Last Name" size="small" theme="concrete" name="lastName"> </rhcl-text-field> <script> var element = document.getElementById("rhcl-text-field-2085585652"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <rhcl-text-field id="rhcl-text-field-1514231422" label="Business Phone" type="text" required max-length="14" min-length="10" min-length-message="Please enter a 10-digit Business Phone number" max-length-message="Please enter a 10-digit Business Phone number" pattern="^[\-\.\(\)\s]*[2-9]{1}[\-\.\(\)\s]*[0-9]{2}[\-\.\(\)\s]*[2-9]{1}(\d[\-\.\(\)\s]*){6}$" error-message="Business Phone is required" format-message="Please enter a 10-digit Business Phone number" size="small" theme="concrete" name="phoneNumber"> </rhcl-text-field> <script> var element = document.getElementById("rhcl-text-field-1514231422"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <rhcl-text-field id="rhcl-text-field--2080298925" label="Work Email" type="email" required max-length="80" min-length="2" min-length-message="Email addresses must be in the following format: sample@test.com" max-length-message="Email addresses must be in the following format: sample@test.com" pattern="(?!.*\.\.)[\-\w.]+@[\w\-.]+\.[A-Za-z]{2,6}(?:,[\-\w.]+@[\w\-.]+\.[A-Za-z]{2,4}){0,4}" error-message="Please enter a valid Work Email" format-message="Email addresses must be in the following format: sample@test.com" size="small" theme="concrete" name="email" error-message-lp="This domain is restricted" error-message-candidate="Please use your work email address"> </rhcl-text-field> <script> const type = document.getElementById("rhcl-text-field--2080298925").getAttribute("type"); if (type === "email") document.getElementById("rhcl-text-field--2080298925").addEventListener("rhcl-text-field-blur", emailValidation); function shouldCheckEmailValidation(value, forceValidation) { const personalEmailFlag = ""; if (!personalEmailFlag && !forceValidation) return; const domainArray = value.split("@"); return !(domainArray.length !== 2 || !value.includes(".")); } function checkEmailValidityForCustomDomains(value) { var allDomains = "gmail.com,yahoo.com,hotmail.com,outlook.com,icloud.com,ymail.com,sbcglobal.net,bellsouth.net,jourrapide.com,comcast.net,cox.net,live.com,att.net,telesyncglobal.com,yelesync.co.us,globalcom.com,msn.com,aol.com,yahoo.co.jp,yahoo.com.br,hotmail.co.uk,yahoo.ae,yahoo.at,yahoo.be,yahoo.ca,yahoo.ch,yahoo.cn,yahoo.co,yahoo.co.id,yahoo.co.il,yahoo.co.in,yahoo.co.kr,yahoo.co.nz,yahoo.co.th,yahoo.co.uk,yahoo.co.za,yahoo.com.ar,yahoo.com.au,yahoo.com.cn,yahoo.com.co,yahoo.com.hk,yahoo.com.is,yahoo.com.mx,yahoo.com.my,yahoo.com.ph,yahoo.com.ru,yahoo.com.sg,yahoo.com.tr,yahoo.com.tw,yahoo.com.vn,yahoo.cz,yahoo.de,yahoo.dk,yahoo.es,yahoo.fi,yahoo.fr,yahoo.gr,yahoo.hu,yahoo.ie,yahoo.in,yahoo.it,yahoo.jp,yahoo.net,yahoo.nl,yahoo.no,yahoo.pl,yahoo.pt,yahoo.ro,yahoo.ru,yahoo.se,hotmail.be,hotmail.ca,hotmail.ch,hotmail.co,hotmail.co.il,hotmail.co.jp,hotmail.co.nz,hotmail.co.za,hotmail.com.ar,hotmail.com.au,hotmail.com.br,hotmail.com.mx,hotmail.com.tr,hotmail.de,hotmail.es,hotmail.fi,hotmail.fr,hotmail.it,hotmail.kg,hotmail.kz,hotmail.my,hotmail.nl,hotmail.ro,hotmail.roor,hotmail.ru,gmail.co.za,gmail.com.au,gmail.com.br,gmail.ru"; var domains = allDomains.split(","); const domainArray = value.split("@"); var domain = domainArray[domainArray.length - 1]; var flag = 0; for (var i = 0; i < domains.length; i++) { if (domain === domains[i]) { flag = 1; break; } } return flag !== 1; } function setEmailCustomErrorMessage(forceValidation) { let emailField = getEmailField(); var message = ""; var value = emailField.value; if (shouldCheckEmailValidation(value, forceValidation)) { var isEmailValid = checkEmailValidityForCustomDomains(value, forceValidation); if (!isEmailValid) { emailField.setAttribute("custom-invalid", ""); var initialMessage = emailField.getAttribute("custom-error-message"); if (initialMessage != null && initialMessage !== "") { if (!initialMessage.includes(message)) { var customMessage = initialMessage + " " + message + " "; emailField.setAttribute("custom-error-message", customMessage); } } else if (initialMessage == null || initialMessage === "") { emailField.setAttribute("custom-error-message", message); } } else if (isEmailValid) { if (emailField.hasAttribute("custom-invalid")) { emailField.removeAttribute("custom-invalid"); } if (emailField.hasAttribute("custom-error-message")) { var initialMessage = emailField.getAttribute("custom-error-message"); if (initialMessage == null || initialMessage === "") emailField.removeAttribute("custom-error-message"); else if (initialMessage != null && initialMessage !== "") { if (initialMessage.includes(message)) { var x = initialMessage.replace(message, ""); emailField.setAttribute("custom-error-message", x); } } } } } else { if (emailField.hasAttribute("custom-invalid")) { emailField.removeAttribute("custom-invalid"); } if ( emailField.hasAttribute("custom-error-message") && emailField.getAttribute("custom-error-message") === "" ) { emailField.removeAttribute("custom-error-message"); } } } function getEmailField() { return document.getElementById( "rhcl-text-field--2080298925" ); } function emailValidation() { let isValid = true; const promises = []; document .getElementById( "rhcl-text-field--2080298925" ) .removeAttribute("custom-invalid"); document.getElementById( "rhcl-text-field--2080298925" ).customInvalid = null; promises.push( document .getElementById( "rhcl-text-field--2080298925" ) .validate() ); Promise.allSettled(promises).then((results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { setEmailCustomErrorMessage(); } }); } </script> <script> { const emailTextField = document.getElementById( "rhcl-text-field--2080298925" ); const emailCheckCandidate = async (forceValidation) => { let candidateEmailRestricted = "true"; forceValidation = typeof forceValidation === 'boolean' ? forceValidation : false; candidateEmailRestricted = candidateEmailRestricted === 'true'; if (!candidateEmailRestricted && !forceValidation) { return; } const promises = []; let isValid = true; emailTextField.removeAttribute("custom-invalid"); emailTextField.customInvalid = null; const email = emailTextField.value; // check for email validity before doing email check promises.push(emailTextField.validate()); await Promise.allSettled(promises).then(async (results) => { results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); if (isValid) { async function accountEmailCheck(email) { return fetch( window.aemSettings.rh_common.accountCheckEndpoint + email ) .then((res) => res.json().then((data) => { /** * { * "isCandidate": true, #true if SFCC response "emailType" is "candidate" * "isClient": false, #true if SFCC response "emailType" is "client" * "accountCheck": "hasWebAccount", # SFCC response "accountCheck" String value * "hasUser": true # SFCC response "hasUser" boolean value, * "needNewResume": true # if SFCC response "lastResumeDate" is older than 6 month or "lastResumeDate" is null * } **/ return data; }) ) .catch((err) => console.error(err)); } await accountEmailCheck(email).then((response) => { if (response?.isCandidate === true) { // candidate email used where it's restricted, show error const restrictedErrorMessage = "Please use your work email address"; emailTextField.customInvalid = true; emailTextField.customErrorMessage = restrictedErrorMessage; } }); } }); }; emailTextField.addEventListener( "rhcl-text-field-blur", emailCheckCandidate ); window.progressiveFrameCandidateEmailCheck = emailCheckCandidate; window.ssjoCandidateEmailCheck = emailCheckCandidate; } </script> <script> var element = document.getElementById("rhcl-text-field--2080298925"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <rhcl-text-field id="rhcl-text-field-1643314141" label="Company Name" type="text" required max-length="40" min-length="2" min-length-message="Company name must have at least 2 characters" max-length-message="Company name cannot be longer than 40 characters" error-message="Please enter a valid Company Name" format-message="Please enter a valid Company Name" size="small" theme="concrete" name="companyName"> </rhcl-text-field> <script> var element = document.getElementById("rhcl-text-field-1643314141"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> <div class="col-md-6 field-element-col"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="rhformtext text aem-GridColumn aem-GridColumn--default--12"> <rhcl-text-field id="rhcl-text-field--1951216206" label="Your Job Title" type="text" required max-length="60" min-length="0" max-length-message="Job title cannot be longer than 60 characters" format-message="Please enter a valid job title" size="small" theme="concrete" name="customerTitle"> </rhcl-text-field> <script> var element = document.getElementById("rhcl-text-field--1951216206"); element.addEventListener("rhcl-text-field-changed", function(){this.value=this.value.trim();}); </script> <script> window.ready(() => { window.addEventListener("rhcl-text-field-blur", e => { const textField = e.target textField.customInvalid = null; textField.customErrorMessage = null; }) }) </script></div> </div> </div> </div> </div> </div> </div> <div class="form-footer row"> <div class="form-submit-btn"> </div> <div class="form-foot-note col-md-12 px-0"> <span class="rhcl-typography rhcl-typography--variant-legal"> </span> </div> </div> </form> <div id="backdrop" class="d-none"> <div class="loader-div"> <rhcl-loading-spinner label="Please Wait" theme="dark" transparency="partial" style="width: 100%; height: 100%;"/> </div> </div> <script src="https://www.google.com/recaptcha/enterprise.js?render=explicit" async defer> </script> <script> { if (!window.common?.getElementByJumpLinkId) { window.common = { ...window.common, /** * this function is to handle getting the element from the jump link id * */ getElementByJumpLinkId: (id) => { let el = document.getElementById(id) if (!el) return const allowedNodeNames = [ 'RHCL-TEXT-FIELD', 'RHCL-TEXTAREA', 'RHCL-DATEPICKER', 'RHCL-TYPEAHEAD', 'RHCL-CHECKBOX', 'RHCL-CHECKBOX-GROUP', 'RHCL-RADIO-GROUP', 'RHCL-DROPDOWN', 'RHCL-SWITCH' ] while (!!el.nextElementSibling && !allowedNodeNames.includes(el.nodeName)) { el = el.nextElementSibling; } if (!allowedNodeNames.includes(el.nodeName)) { // there was no sibling to the element with that id that is a valid input console.error('Could not find a valid input element with this id:', id) // return undefined instead of last found node return } return el } } } const initialEndpoint = ''; const initialEndpointType = ''; const basicFormEndpoint = 'https:\/\/prd\u002Ddr.ma.api.roberthalfonline.com\/form\u002Dsubmission\/submit'; const ssjoEndpoint = 'https:\/\/prd\u002Ddr.lp.api.roberthalfonline.com\/proxy\u002Dlead\u002Dprocessing\/send'; const jobAlertsEndpoint = 'https:\/\/prd\u002Ddr.ma.api.roberthalfonline.com\/job\u002Dalerts\/subscribe'; const formContainer = document.querySelector('form.form-container'); // get the form routing destinations const destinations = document.querySelectorAll('input[data-form-routing="true"]') const destinationControls = []; // get array of all destinations controls and required values Array.from(destinations).forEach(destination => { const relatedId = destination.dataset.formRoutingId; const requiredValue = destination.dataset.formRoutingValue; const routingEndpointTypes = destination.dataset.formRoutingSsjoEndpoint; const routingEndpointTypesArray = routingEndpointTypes.split(','); if (!relatedId) return; // skip elements where the dataset has no details // check required value on related id const controlElement = window.common.getElementByJumpLinkId(relatedId); destinationControls.push({controlElement, requiredValue, routingEndpointTypesArray}) }) // listen on any change of the control elements const mutationObserver = new MutationObserver(mutations => { mutations.forEach(mutation => { updateFormEndpoint(); }) }) destinationControls.forEach(({ controlElement }) => { mutationObserver.observe( controlElement, { attributes: true, attributeFilter: ['value', 'selected']} ) }); // update the form action to use the correct endpoint const updateFormEndpoint = () => { let endpointList = {}; let actionEndpoint = initialEndpoint; endpointList[initialEndpointType] = initialEndpoint; destinationControls.some(({ controlElement, requiredValue, routingEndpointTypesArray }) => { if (controlElement.value === requiredValue) { endpointList = {}; routingEndpointTypesArray.forEach((routingEndpointType) => { switch (routingEndpointType) { case 'leads': endpointList['leads'] = ssjoEndpoint; actionEndpoint = ssjoEndpoint; break; case 'nonLeads': endpointList['nonLeads'] = basicFormEndpoint; actionEndpoint = basicFormEndpoint; break; case 'jobAlerts': endpointList['jobAlerts'] = jobAlertsEndpoint; actionEndpoint = jobAlertsEndpoint; break; default: console.log("No EndpointType found for Form Submission. -- ", routingEndpointType); break; } }); return true; } return false; }); formContainer.action = actionEndpoint || formContainer.action; formContainer.dataset.attributeEndpoints = JSON.stringify(endpointList) || formContainer.dataset.attributeEndpoints; }; // initial form endpoint setup updateFormEndpoint(); } </script> </div> </rhcl-progressive-frame-step> </div> <div class="progressiveframestep containernowrapper container responsivegrid" data-aem-wrapper="true" slot="step"> <rhcl-progressive-frame-step disable-back-button="true" label="Thank you" page-type="confirmation"> <div slot="content"> <div class="cq-placeholder" data-emptytext="COP Copy Block"></div> <div class="rhcl-content-container"> <rhcl-block-copy variant="standard"> <rhcl-typography slot="copy"><h2 style=" text-align: center; ">Redirecting...</h2> </rhcl-typography> </rhcl-block-copy> </div> </div> </rhcl-progressive-frame-step> </div> </rhcl-progressive-frame> <script> { const thisFrame = document.getElementById( "rhcl-progressive-frame--1869830734" ); thisFrame.addEventListener( "rhcl-progressive-frame-step-next-clicked", onNextFrame ); thisFrame.addEventListener( "rhcl-progressive-frame-step-submit-clicked", onSubmit ); window.ready(() => { // setup response handlers thisFrame.addEventListener( "rh-progressive-frame-submission-response", handleFrameResponse ); thisFrame.addEventListener( "rh-progressive-frame-submission-error", handleFrameError ); }) async function onNextFrame(e) { if (await isValidFrameStep(e.target)) { const submissionEvent = new CustomEvent( "rh-progressive-frame-submission", { detail: { frame: thisFrame, isFinalSubmission: false, step: e.target } } ); window.dispatchEvent(submissionEvent); } } async function onSubmit(e) { if (await isValidFrameStep(e.target)) { // handle submission const submissionEvent = new CustomEvent( "rh-progressive-frame-submission", { detail: { frame: thisFrame, isFinalSubmission: true, step: e.target } } ); // start form submission window.dispatchEvent(submissionEvent); } } // on frame next successful response function handleFrameResponse({ detail }) { thisFrame.progressFrame(); } /** * returns the current frame step element for a frame. * @param frame the frame element to return the current step from. */ function getFrameStep(frame) { return frame.children[frame.currentStepIndex] } function handleLpErrors(stepFields, errors) { const dataValidationErrorCodes = [ {error:"20_validationFailed_positionTitle", field: "positionTitle"}, {error:"20_validationFailed_postalCode", field: "postalCode"}, {error:"20_validationFailed_email", field: "email"}, ]; stepFields.forEach(stepField => { const fieldError = dataValidationErrorCodes.find( errorCode => errorCode.field === stepField.name && errors.includes(errorCode.error) ) if (fieldError && stepField.getAttribute("error-message-lp")) { stepField.customInvalid = true stepField.customErrorMessage = stepField.getAttribute("error-message-lp") .replaceAll("[token:value]", stepField.value) } }) } // on frame submit error function handleFrameError({ detail }) { const errors = detail.errors if (errors) { const frame = detail.frame const frameStep = getFrameStep(frame) const stepFields = frameStep.querySelectorAll("[rhcl-input]"); handleLpErrors(stepFields, errors) } else { console.error("Unhandled frame error.", { detail }) } } function isValidEmail(email) { const emailParts = email.split("@"); const allDomains = "gmail.com,yahoo.com,hotmail.com,outlook.com,icloud.com,ymail.com,sbcglobal.net,bellsouth.net,jourrapide.com,comcast.net,cox.net,live.com,att.net,telesyncglobal.com,yelesync.co.us,globalcom.com,msn.com,aol.com,yahoo.co.jp,yahoo.com.br,hotmail.co.uk,yahoo.ae,yahoo.at,yahoo.be,yahoo.ca,yahoo.ch,yahoo.cn,yahoo.co,yahoo.co.id,yahoo.co.il,yahoo.co.in,yahoo.co.kr,yahoo.co.nz,yahoo.co.th,yahoo.co.uk,yahoo.co.za,yahoo.com.ar,yahoo.com.au,yahoo.com.cn,yahoo.com.co,yahoo.com.hk,yahoo.com.is,yahoo.com.mx,yahoo.com.my,yahoo.com.ph,yahoo.com.ru,yahoo.com.sg,yahoo.com.tr,yahoo.com.tw,yahoo.com.vn,yahoo.cz,yahoo.de,yahoo.dk,yahoo.es,yahoo.fi,yahoo.fr,yahoo.gr,yahoo.hu,yahoo.ie,yahoo.in,yahoo.it,yahoo.jp,yahoo.net,yahoo.nl,yahoo.no,yahoo.pl,yahoo.pt,yahoo.ro,yahoo.ru,yahoo.se,hotmail.be,hotmail.ca,hotmail.ch,hotmail.co,hotmail.co.il,hotmail.co.jp,hotmail.co.nz,hotmail.co.za,hotmail.com.ar,hotmail.com.au,hotmail.com.br,hotmail.com.mx,hotmail.com.tr,hotmail.de,hotmail.es,hotmail.fi,hotmail.fr,hotmail.it,hotmail.kg,hotmail.kz,hotmail.my,hotmail.nl,hotmail.ro,hotmail.roor,hotmail.ru,gmail.co.za,gmail.com.au,gmail.com.br,gmail.ru"; const domains = allDomains.split(","); if (emailParts.length !== 2 || !email.includes(".")) { return false; } const emailDomain = emailParts[1]; // user email domain in restricted domains is invalid return !domains.includes(emailDomain); } async function isValidFrameStep(frameStep) { // wait for email checks if there is one in progress if (frameStep.querySelector("[name='email']") && window.progressiveFrameCandidateEmailCheck) { window.progressiveFrameLoaderVisible(true) await window.progressiveFrameCandidateEmailCheck() window.progressiveFrameLoaderVisible(false) } // get step fields const stepFields = frameStep.querySelectorAll("[rhcl-input]"); let promises = []; let isValid = true; // if the field has a validate function add it to list to validate stepFields.forEach((el) => { if ( typeof el.validate === "function" && !el.getAttribute("form-submission-hidden") ) { promises.push(el.validate()); } }); // wait for all field validation const results = await Promise.allSettled(promises); results.forEach((result) => { if (result.status === "fulfilled") { if (!result.value) { isValid = false; } } }); // handle email validation specifically const emailInput = frameStep.querySelector( '[id^="rhcl-text-field"][type="email"]' ); if (emailInput) { const emailValue = emailInput.value; if (!isValidEmail(emailValue)) { isValid = false; } } return isValid; } } </script> </div> </div> <div class="rhformhiddenfield hidden aem-GridColumn aem-GridColumn--default--12"> <input type="hidden" id="formUrl" name="formUrl" value="www.roberthalf.com/us/en/hire-talent/form"/> </div> </div> </div> </div> </div> <rhcl-content-card slot="card" variant="icon" layout="horizontal" headline="Get started online" copy="Create your account to see a sample of candidates instantly on our digital platform." icon="user-search" cta-external="false"> </rhcl-content-card> <rhcl-content-card slot="card" variant="icon" layout="horizontal" headline="See recruiter assessed candidates" copy="An experienced recruiter will connect with you and curate a list of available candidates." icon="people-arrows" cta-external="false"> </rhcl-content-card> <rhcl-content-card slot="card" variant="icon" layout="horizontal" headline="Review, select, and hire" copy="We help with interview coordination, extending offers, and more!" icon="user-group" cta-external="false"> </rhcl-content-card> <span slot="escape-hatch"><p style=" text-align: left; ">Need immediate help? Call <a href="tel:8554320924" data-invoca-campaign-id="national_content_us">855-432-0924</a></p> </span> </rhcl-block-hero-form> </div> </div> <div class="cmp-rhcl-stacking-cards-block-wrapper aem-GridColumn aem-GridColumn--default--12"> <div id="stackingcardsblock-a88a37417a" class="cmp-container"> <rhcl-block-stacking-cards card-variant="basic"> <h2 slot="headline">Need more than a talent solution?</h2> <span slot="copy">Achieve your business goals with our executive search and consulting services.</span> <rhcl-content-card slot="card" headline="Retained executive search" copy="Let our experienced consultants identify qualified senior leaders, often within 90 days." icon="-- Select an Icon --" cta-label="Find your next senior leader" cta-destination="/us/en/hire-talent/executive-search#form" cta-external="false"> </rhcl-content-card> <rhcl-content-card slot="card" headline="Consulting solutions" copy="Let our consultants customize a solution to help meet your business objective." cta-label="Speak with a consultant" cta-destination="/us/en/consulting#form" cta-external="false"> </rhcl-content-card> </rhcl-block-stacking-cards> </div> </div> <div class="experiencefragment aem-GridColumn aem-GridColumn--default--12"> <div id="experiencefragment-e00e3eb441" class="cmp-experiencefragment cmp-experiencefragment--tcb"> <div id="container-7a9545b883" class="cmp-container"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="cmp-rhcl-tabbed-content-block-wrapper aem-GridColumn aem-GridColumn--default--12"> <div id="tabbedcontentblock-2fc8f755c8" class="cmp-container"> <rhcl-block-tabbed-content variant="horizontal" layout="media-right"> <h2 slot="headline">Add specialized talent across your organization</h2> <div class="tabbedcontenthorizontal container responsivegrid" data-aem-wrapper="true" slot="tab"> <rhcl-tab-item slot="tab" label="Finance & Accounting"> <span slot="label">Finance & Accounting</span> <rhcl-typography slot="copy">From accountants to CFOs, we’ll bring you top candidates with in-demand skills and experience and help manage the hiring process for you. </rhcl-typography> <rhcl-content-list headline="Trending job titles" layout="column" variant="link" slot="list" decorative="false"> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/controller" target="_self">Controller</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/senior-accountant-general-accounting" target="_self">Senior accountant</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/senior-financial-analyst" target="_self">Senior financial analyst</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/internal-auditor-1-3-years-experience-financial-services" target="_self">Internal auditor</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/accounts-payable-clerk" target="_self">Accounts payable/receivable specialist</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/bookkeeper" target="_self">Bookkeeper</a></rhcl-content-list-item> </rhcl-content-list> <a slot="cta" href="/us/en/accounting-finance" target="_self">Learn more about our Accounting and Finance hiring solutions</a> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 480px,(min-width: 768px) 336px,(min-width: 0px) 317px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha 480w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Medium-1x$&fmt=webp-alpha 336w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Small-1x$&fmt=webp-alpha 317w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> </rhcl-tab-item> </div> <div class="tabbedcontenthorizontal container responsivegrid" data-aem-wrapper="true" slot="tab"> <rhcl-tab-item slot="tab" label="Technology"> <span slot="label">Technology</span> <rhcl-typography slot="copy">From cybersecurity professionals to developers, we’ll bring you top candidates with in-demand skills and experience and help manage the hiring process for you.</rhcl-typography> <rhcl-content-list headline="Trending job titles" layout="column" variant="link" slot="list" decorative="false"> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/software-engineerdeveloper" target="_self">Software developer</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/data-analyst-technology" target="_self">Data analyst</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/it-systems-analyst" target="_self">Systems analyst</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/product-support-specialist" target="_self">Product support specialist</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/networkcloud-administrator" target="_self">Network administrator</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/web-developer" target="_self">Web developer</a></rhcl-content-list-item> </rhcl-content-list> <a slot="cta" href="/us/en/tech-it" target="_self">Learn more about our Technology hiring solutions</a> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 480px,(min-width: 768px) 336px,(min-width: 0px) 317px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha 480w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Medium-1x$&fmt=webp-alpha 336w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Small-1x$&fmt=webp-alpha 317w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> </rhcl-tab-item> </div> <div class="tabbedcontenthorizontal container responsivegrid" data-aem-wrapper="true" slot="tab"> <rhcl-tab-item slot="tab" label="Administrative & Customer Support"> <span slot="label">Administrative & Customer Support</span> <rhcl-typography slot="copy">From office managers to customer service professionals, we’ll bring you top candidates with in-demand skills and experience and help manage the hiring process for you.</rhcl-typography> <rhcl-content-list headline="Trending job titles" layout="column" variant="link" slot="list" decorative="false"> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/administrative-assistant" target="_self">Administrative assistant</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/executive-assistant" target="_self">Executive assistant</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/customer-experience-specialist" target="_self">Customer experience representative</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/receptionist" target="_self">Receptionist</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/office-specialist" target="_self">Office specialist</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/data-entry-specialist" target="_self">Data entry specialist</a></rhcl-content-list-item> </rhcl-content-list> <a slot="cta" href="/us/en/administrative" target="_self">More about our Admin and Customer Support hiring solutions</a> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 480px,(min-width: 768px) 336px,(min-width: 0px) 317px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha 480w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Medium-1x$&fmt=webp-alpha 336w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Small-1x$&fmt=webp-alpha 317w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> </rhcl-tab-item> </div> <div class="tabbedcontenthorizontal container responsivegrid" data-aem-wrapper="true" slot="tab"> <rhcl-tab-item slot="tab" label="Marketing & Creative"> <span slot="label">Marketing & Creative</span> <rhcl-typography slot="copy">From copywriters to creative directors, we’ll bring you top candidates with in-demand skills and experience and help manage the hiring process for you.</rhcl-typography> <rhcl-content-list headline="Trending job titles" layout="column" variant="link" slot="list" decorative="false"> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/graphic-designer" target="_self">Graphic designer</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/copywriter" target="_self">Copywriter</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/production-artist" target="_self">Production artist</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/digital-marketing-specialist" target="_self">Digital marketing specialist</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/user-experience-ux-designer" target="_self">UX designer</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/marketing-manager" target="_self">Marketing manager</a></rhcl-content-list-item> </rhcl-content-list> <a slot="cta" href="/us/en/marketing-creative" target="_self">Learn more about our Marketing and Creative hiring solutions</a> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 480px,(min-width: 768px) 336px,(min-width: 0px) 317px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha 480w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Medium-1x$&fmt=webp-alpha 336w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Small-1x$&fmt=webp-alpha 317w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> </rhcl-tab-item> </div> <div class="tabbedcontenthorizontal container responsivegrid" data-aem-wrapper="true" slot="tab"> <rhcl-tab-item slot="tab" label="Legal" legal-copy="Robert Half is not a law firm and does not provide legal representation. Robert Half project attorneys do not constitute a law firm among themselves. "> <span slot="label">Legal</span> <rhcl-typography slot="copy">From lawyers to paralegals, we’ll bring you top candidates with in-demand skills and experience and help manage the hiring process for you. </rhcl-typography> <rhcl-content-list headline="Trending job titles" layout="column" variant="link" slot="list" decorative="false"> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/lawyerattorney-2-3-years-experience" target="_self">Lawyer</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/paralegal-2-3-years-experience" target="_self">Paralegal</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/legal-assistant" target="_self">Legal assistant</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/in-house-counsel-4-9-years-experience" target="_self">In-house counsel</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/contract-administrator-4-6-years-experience" target="_self">Contract administrator</a></rhcl-content-list-item> <rhcl-content-list-item slot="item"><a href="/us/en/job-details/legal-secretary-1-2-years-experience" target="_self">Legal secretary</a></rhcl-content-list-item> </rhcl-content-list> <a slot="cta" href="/us/en/legal" target="_self">Learn more about our Legal hiring solutions</a> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 480px,(min-width: 768px) 336px,(min-width: 0px) 317px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha 480w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Medium-1x$&fmt=webp-alpha 336w,https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Small-1x$&fmt=webp-alpha 317w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq2-1875262279?$Squircle2-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401941?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> <!-- using dynamic media template --> <img slot="accent-image" loading="lazy" fetchpriority="low" sizes="(min-width: 1024px) 307px,(min-width: 768px) 230px,(min-width: 0px) 288px" srcset="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha 307w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Medium-1x$&fmt=webp-alpha 230w,https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Small-1x$&fmt=webp-alpha 288w" src="https://s7d9.scene7.com/is/image/roberthalfintl/sq1-2038401536?$Squircle1-Large-1x$&fmt=webp-alpha" alt aria-hidden="true"/> </rhcl-tab-item> </div> </rhcl-block-tabbed-content> </div> </div> </div> </div> </div> </div> <div class="experiencefragment aem-GridColumn aem-GridColumn--default--12"> <div id="experiencefragment-06bb50d9e0" class="cmp-experiencefragment cmp-experiencefragment--accolades"> <div id="container-a5268bee0f" class="cmp-container"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="cmp-rhcl-accolades-block-wrapper aem-GridColumn aem-GridColumn--default--12"> <div id="accoladesblock-7353e45cdd" class="cmp-container"> <rhcl-block-accolades> <h2 slot="headline">You’re in good company</h2> <a slot="cta" href="/us/en/about/our-company" target="_self">See all accolades</a> <div class="accolade contentcard teaser" data-aem-wrapper="true" slot="card"> <rhcl-content-card slot="card" legal-copy="Disclaimer: From Fortune. ©2025 Fortune Media IP Limited. All rights reserved. Fortune is a registered trademark of Fortune Media IP Limited and is used under license. Fortune and Fortune Media IP Limited are not affiliated with, and do not endorse products or services of, Robert Half Inc." copy="2025"> <span slot="headline"><i><b>Fortune</b></i><b>®</b> World's Most Admired Companies™ </span> </rhcl-content-card> </div> <div class="accolade contentcard teaser" data-aem-wrapper="true" slot="card"> <rhcl-content-card slot="card" copy="2024"> <span slot="headline"><b>Forbes' America's Best Professional Recruiting Firms</b> </span> </rhcl-content-card> </div> <div class="accolade contentcard teaser" data-aem-wrapper="true" slot="card"> <rhcl-content-card slot="card" copy="2023"> <span slot="headline"><b><i><br /> </i></b><i><b>Fortune</b></i><b>® America's Most Innovative Companies</b><br /> </span> </rhcl-content-card> </div> </rhcl-block-accolades> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div class="experiencefragment aem-GridColumn aem-GridColumn--default--12"> <div id="experiencefragment-8082353bc2" class="cmp-experiencefragment cmp-experiencefragment--footer"> <div id="container-cec186e8c7" class="cmp-container"> <div class="aem-Grid aem-Grid--12 aem-Grid--default--12 "> <div class="footer aem-GridColumn aem-GridColumn--default--12"> <rhcl-footer logo-destination="/us/en" variant="default"> <rhcl-list-base slot="menu" headline="Services" headline-tag="h2"> <rhcl-menu-link slot="item" data-modal-identifier="linklist_1_modal_1"> <a slot="item" href="/us/en/jobs">Browse Jobs</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_1_modal_2"> <a slot="item" href="/us/en/hire-talent/flexible-staffing">Contract Talent</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_1_modal_3"> <a slot="item" href="/us/en/hire-talent/full-time-staffing">Permanent Talent</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_1_modal_4"> <a slot="item" href="/us/en/consulting">Consulting Solutions</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="menu" headline="Areas of Expertise" headline-tag="h2"> <rhcl-menu-link slot="item" data-modal-identifier="linklist_2_modal_1"> <a slot="item" href="/us/en/accounting-finance">Finance & Accounting</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_2_modal_2"> <a slot="item" href="/us/en/tech-it">Technology</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_2_modal_3"> <a slot="item" href="/us/en/marketing-creative">Marketing & Creative</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_2_modal_4"> <a slot="item" href="/us/en/administrative">Administrative & Customer Support</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_2_modal_5"> <a slot="item" href="/us/en/legal">Legal</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="menu" headline="Resources & Tools" headline-tag="h2"> <rhcl-menu-link slot="item" data-modal-identifier="linklist_3_modal_1"> <a slot="item" href="/us/en/insights">Discover Insights</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_3_modal_2"> <a slot="item" href="/us/en/pay">Invoice</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_3_modal_3"> <a slot="item" href="/us/en/job-details-all">Job Directory</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_3_modal_4"> <a slot="item" href="/us/en/insights/salary-guide">Salary Guide</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_3_modal_5"> <a slot="item" href="/us/en/login">Time Reports</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_3_modal_6"> <a slot="item" href="/us/en/contact">Contact Us</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="menu" headline="About" headline-tag="h2"> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_1"> <a slot="item" href="/us/en/about/about-robert-half">About Robert Half</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_2"> <a slot="item" href="/us/en/about/leadership">Leadership</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_3"> <a slot="item" href="https://careers.roberthalf.com/global/en/home">Careers With Us</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_4"> <a slot="item" href="/us/en/locations">Locations</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_5"> <a slot="item" href="/us/en/about/investor-center">Investor Center</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_6"> <a slot="item" href="https://press.roberthalf.com/">Press</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_7"> <a slot="item" href="/us/en/about/our-company/brands">Our Brands</a> </rhcl-menu-link> <rhcl-menu-link slot="item" data-modal-identifier="linklist_4_modal_8"> <a slot="item" href="/us/en/about/supplier-relations">Supplier Relations</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="social-menu"> <rhcl-menu-link slot="item" icon="facebook" description="Facebook"> <a slot="item" href="https://www.facebook.com/pages/Robert-Half/182444181913924"></a> </rhcl-menu-link> <rhcl-menu-link slot="item" icon="linkedin" description="LinkedIn"> <a slot="item" href="https://www.linkedin.com/company/robert-half-international"></a> </rhcl-menu-link> <rhcl-menu-link slot="item" icon="twitter" description="Twitter"> <a slot="item" href="https://twitter.com/roberthalf"></a> </rhcl-menu-link> <rhcl-menu-link slot="item" icon="youtube" description="Youtube"> <a slot="item" href="https://www.youtube.com/roberthalfna"></a> </rhcl-menu-link> <rhcl-menu-link slot="item" icon="instagram" description="Instagram"> <a slot="item" href="https://www.instagram.com/roberthalf/"></a> </rhcl-menu-link> </rhcl-list-base> <rhcl-list-base slot="legal-menu"> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/fraud-alert">Fraud Alert</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/government-notice">Government Notice</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/privacy">Privacy Notice</a> </rhcl-menu-link> <rhcl-menu-link slot="item"> <a slot="item" href="/us/en/terms">Terms of Use</a> </rhcl-menu-link> </rhcl-list-base> <rhcl-typography slot="copyright">Robert Half Inc. <a href="/us/en/equal-opportunity-employer" target="_self" title="equal-opportunity-employer" rel="noopener noreferrer">An Equal Opportunity Employer</a> <a href="/us/en/equal-opportunity-employer" target="_self" title="equal-opportunity-employer" rel="noopener noreferrer">M/F/Disability/Veterans.</a> <a href="#" class="ot-sdk-show-settings">Do Not Sell or Share My Personal Information</a></rhcl-typography> <rhcl-country-selector slot="locale-selector" name="locale"> <a data-locale="en-AU" href="https://www.roberthalf.com/au/en" slot="link"> Australia - English </a> <a data-locale="en-BE" href="https://www.roberthalf.com/be/en" slot="link"> Belgium - English </a> <a data-locale="nl-BE" href="https://www.roberthalf.com/be/nl" slot="link"> Belgium - Nederlands </a> <a data-locale="fr-BE" href="https://www.roberthalf.com/be/fr" slot="link"> Belgium - Français </a> <a data-locale="pt-BR" href="https://www.roberthalf.com/br/pt" slot="link"> Brazil - Português </a> <a data-locale="en-CA" href="https://www.roberthalf.com/ca/en" slot="link"> Canada - English </a> <a data-locale="fr-CA" href="https://www.roberthalf.com/ca/fr" slot="link"> Canada - Français </a> <a data-locale="es-CL" href="https://www.roberthalf.com/cl/es" slot="link"> Chile - Español </a> <a data-locale="en-CN" href="https://www.roberthalf.cn/cn/en" slot="link"> China - English </a> <a data-locale="zh-CN" href="https://www.roberthalf.cn/cn/zh" slot="link"> China - 中文 </a> <a data-locale="fr-FR" href="https://www.roberthalf.com/fr/fr" slot="link"> France - Français </a> <a data-locale="de-DE" href="https://www.roberthalf.com/de/de" slot="link"> Germany - Deutsch </a> <a data-locale="en-HK" href="https://www.roberthalf.com/hk/en" slot="link"> Hong Kong, China - English </a> <a data-locale="en-IE" href="https://www.roberthalf.com/ie/en" slot="link"> Ireland - English </a> <a data-locale="en-JP" href="https://www.roberthalf.com/jp/en" slot="link"> Japan - English </a> <a data-locale="ja-JP" href="https://www.roberthalf.com/jp/ja" slot="link"> Japan - 日本語 </a> <a data-locale="en-LU" href="https://www.roberthalf.com/lu/en" slot="link"> Luxembourg - English </a> <a data-locale="fr-LU" href="https://www.roberthalf.com/lu/fr" slot="link"> Luxembourg - Français </a> <a data-locale="en-NL" href="https://www.roberthalf.com/nl/en" slot="link"> Netherlands - English </a> <a data-locale="nl-NL" href="https://www.roberthalf.com/nl/nl" slot="link"> Netherlands - Nederlands </a> <a data-locale="en-NZ" href="https://www.roberthalf.com/nz/en" slot="link"> New Zealand - English </a> <a data-locale="en-SG" href="https://www.roberthalf.com/sg/en" slot="link"> Singapore - English </a> <a data-locale="de-CH" href="https://www.roberthalf.com/ch/de" slot="link"> Switzerland - Deutsch </a> <a data-locale="en-CH" href="https://www.roberthalf.com/ch/en" slot="link"> Switzerland - English </a> <a data-locale="fr-CH" href="https://www.roberthalf.com/ch/fr" slot="link"> Switzerland - Français </a> <a data-locale="en-AE" href="https://www.roberthalf.com/ae/en" slot="link"> United Arab Emirates - English </a> <a data-locale="en-GB" href="https://www.roberthalf.com/gb/en" slot="link"> United Kingdom - English </a> <a data-locale="en-US" href="https://www.roberthalf.com/us/en/hire-talent/form" slot="link"> United States - English </a> </rhcl-country-selector> </rhcl-footer> <rhcl-back-to-top-button></rhcl-back-to-top-button> <style> rhcl-back-to-top-button{--rhcl-floating-button-bottom:260px} </style> <script type="text/javascript"> window.addEventListener("rhcl-menu-link-clicked", (e) => { e.preventDefault(); let link = e.composedPath()[0]; if(link.hasAttribute('data-modal-popup')) { let modalId = link.getAttribute('data-modal-identifier'); let modal = document.querySelector(`div#${modalId} rhcl-modal`); modal.setAttribute('show-modal', true); } }); document.addEventListener('rhcl-locale-selector-item-clicked', function (e) { if(e && e.detail){ window.location.href = e.detail; } }); </script> </div> </div> </div> </div> </div> </div> </div> </div> <link rel="preload" href="https://rh.my.salesforce-sites.com/liveagent/EinsteinBotEmbedCSS" as="style" onload="this.onload=null;this.rel='stylesheet'"/> <noscript><link rel="stylesheet" href="https://rh.my.salesforce-sites.com/liveagent/EinsteinBotEmbedCSS"/></noscript> </body> </html>