Skip to content

Commit

Permalink
HubSpot: check that form email input is not-prepopulated before addin…
Browse files Browse the repository at this point in the history
…g firstSourceURL (#2765)
  • Loading branch information
attfarhan authored Mar 24, 2021
1 parent 8b884d4 commit 348ab7a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion website/src/components/HubSpot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ export function createHubSpotForm({ portalId, formId, targetId, onFormSubmit, on
}

const firstSourceURLInput = form.querySelector<HTMLInputElement>('input[name="first_source_url"]')
if (firstSourceURLInput && firstSourceURLInput.value === '') {
const emailInput = form.querySelector<HTMLInputElement>('input[name="email"]')
if (
firstSourceURLInput &&
firstSourceURLInput.value === '' &&
emailInput &&
emailInput.value === ''
) {
// Populate the hidden first_source_url form field with the value from the sourcegraphSourceUrl cookie.
firstSourceURLInput.value = firstSourceURL || ''
}
Expand Down

0 comments on commit 348ab7a

Please sign in to comment.