Skip to main content

Hi There — I have a lead capture form that among some general questions, has a Yes/No question — “Do you want to book a Demo?” 

If “Yes”, I want the URL on the “Submit” button to go to a certain URL.

If “No”, I want the URL on the “Submit” button to go to the regular Thank You page (which it already does).

 

How can I accomplish this?

 

Thanks in advance :)

Hi ​@Hud_Rock 

Zap action: Formatter > Utilities > Lookup Table

Help: https://zapier.com/apps/formatter/help


Hi Troy — I’m not sure I follow how this helps me accomplish the above… Could you clarify?


@Hud_Rock 

What app are you using for the lead capture form?


The conditional logic probably needs to be on the form.

If the form builder doesn’t provide an option one way would be to set two submit buttons switched via javascript based on the value in the boolean field. 

If Yes Show submit button A, if No show submit button B.

Below is a rough idea from ChatGPT  to achieve the what you were looking for on the form. 
 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Submit Button</title>
</head>
<body>
<form id="demoForm">
<label for="demoChoice">Do you want a demo?</label>
<select id="demoChoice" name="demoChoice" onchange="updateSubmitButton()">
<option value="" selected disabled>Select an option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<div id="submitContainer">
<!-- Submit button will be dynamically updated -->
</div>
</form>

<script>
function updateSubmitButton() {
const choice = document.getElementById('demoChoice').value;
const submitContainer = document.getElementById('submitContainer');

// Clear any existing buttons
submitContainer.innerHTML = '';

// Create a new submit button
const submitButton = document.createElement('button');
submitButton.type = 'submit';

if (choice === 'yes') {
submitButton.textContent = 'Send to Demo (URL A)';
submitButton.onclick = () => {
document.getElementById('demoForm').action = 'https://example.com/urlA';
};
} else if (choice === 'no') {
submitButton.textContent = 'Send to Info (URL B)';
submitButton.onclick = () => {
document.getElementById('demoForm').action = 'https://example.com/urlB';
};
}

// Append the new button to the form
submitContainer.appendChild(submitButton);
}
</script>
</body>
</html>

 


I’m using the native Zapier form.


Reply