I have a website in which I am embedding the hubspot form. After I submit the form, I want it to go to a link, dependent on if a certain question was answered or not. Is it possible to get a specific question value (to check if it is undefined?)
Is this correct? var testing1Value = response.data.fields.testing1;"
function handleFormSubmit(response) {
var chartContainer = document.getElementById(‘chartContainer’);
var testing1Value = response.getResponse().getField(‘testing’);
// Display different charts based on the field value
if (testing1Value && testing1Value.trim().length > 0) {
// Chart for answered question
var chartHtml = ‘<iframe src=“https://docs.google.com/spreadsheets/…;headers=false” width=“100%” height=“400”></iframe>’;
chartContainer.innerHTML = chartHtml;
} else {
// Chart for unanswered question
chartContainer.innerHTML = “”; // Clear the chart container if the field is empty
}
}
</script>
<!-- Chart container -->
<div id=“chartContainer”></div>
</body>
</html>