Hona
unknown
javascript
8 months ago
983 B
8
Indexable
<script
charset="utf-8"
type="text/javascript"
src="//js.hsforms.net/forms/embed/v2.js"
></script>
<script>
hbspt.forms.create({
region: "na1",
portalId: "20940147",
formId: "2683e429-f567-412e-8d3f-d8c67ffdee7c",
//Snippet to add
onFormSubmit: function (fo) {
// Get the hubspot form element
const hsForm = fo.nodeName === "FORM" ? fo : fo[0];
// Your custom function to set the day of the week
const daysOfWeek = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
const currentDate = new Date();
const currentDay = currentDate.getDay();
// Target the field using the 'name' attribute
hsForm.querySelector("[name='current_day_of_week']").value =
daysOfWeek[currentDay];
},
});
</script>Editor is loading...
Leave a Comment