This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'https://api.hsforms.com/submissions/v3/integration/submit/portalId/formGuid', | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
setTimeout(function() { | |
const emailInput = document.querySelector('input[name="2-8330456/tour_contact_email"]'); | |
emailInput.addEventListener("input", function() { | |
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; | |
const parentDiv = emailInput.closest('.input'); | |
let messageDiv = parentDiv.querySelector('.email-error'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PHP SCRIPT TO MOVE PROPERTIES FROM A STANDARD OBJECT TO A CUSOTM OBJECT | |
// READ ME | |
// MODIFY THESE VARIABLES BELOW AS YOU SEE FIT (LINES 8-10) | |
// ALSO MODIFY THE GROUP NAME MAPPINGS BELOW (LINES 53-56) | |
$authToken = 'ADD_YOUR_TOKEN_HERE'; | |
$standardObject = 'contacts'; | |
$customObjectInternalName = '2-37668321'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
// Wait for the form to load | |
setTimeout(function() { | |
var urlInput = document.querySelector('input[name="url_of_page"]'); | |
if (urlInput) { | |
console.log('url_of_page input exists'); | |
urlInput.value = window.location.href; | |
} | |
},1000); // Adjust the delay if needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.onload = function () { | |
// Function to poll for the existence of the input field | |
function waitForElement(selector, callback) { | |
const inputField = document.getElementsByName(selector)[0]; | |
if (inputField) { | |
callback(inputField); | |
} else { | |
setTimeout(function () { | |
waitForElement(selector, callback); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include the following scripts that can be found here https://select2.org/getting-started/installation | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" /> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script> | |
// in the below, we listen for the form to load, then switch out the standard select element (by name) with a select2 element | |
<script> | |
window.addEventListener('message', event => { | |
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') { | |
// Initialize Select2 on the specified select element - update with the internal name of the property where it says internal_select_name | |
const selectElement = $('select[name=internal_select_name]').select2(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = "api.hubspot.com/events/v3/events/?objectType=contact&objectId=52054635672" | |
payload = "" | |
headers = { | |
'Authorization': '••••••' | |
} | |
response = requests.request("GET", url, headers=headers, data=payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.main = async (event, callback) => { | |
var phone = event.inputFields['phone']; | |
console.log("Input Phone: ", phone) | |
const outputFields = { | |
valid: false, | |
validation_message: "", | |
phone: "" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
setTimeout(function() { | |
const emailInput = document.querySelector('input[name="firstname"]'); | |
emailInput.addEventListener("input", function() { | |
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; | |
const parentDiv = emailInput.closest('.input'); | |
let messageDiv = parentDiv.querySelector('.email-error'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
exports.main = async (event, callback) => { | |
const auth = 'Bearer ' + process.env.CHANGE_THIS_VALUE_TO_MATCH_YOUR_SECRET_NAME; | |
const email = event.inputFields['email']; | |
let data = JSON.stringify({ | |
"filters": [ | |
{ |
NewerOlder