Skip to main content
Question

How do I set two different URL's on a Lead Capture Form submission, conditional on a Yes/No question?

  • November 21, 2024
  • 8 replies
  • 72 views

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 :)

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • November 21, 2024

Hi ​@Hud_Rock 

Zap action: Formatter > Utilities > Lookup Table

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


  • Author
  • Beginner
  • November 21, 2024

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


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • November 21, 2024

@Hud_Rock 

What app are you using for the lead capture form?


Badger
Forum|alt.badge.img+5
  • New
  • November 22, 2024

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>

 


  • Author
  • Beginner
  • November 24, 2024

I’m using the native Zapier form.


Badger
Forum|alt.badge.img+5
  • New
  • November 24, 2024

My understanding is that Conditional Logic on Zapier Forms is not applied to the Submit button only to fields.

Your zap will need to filter based on the results after submission not before.


  • Author
  • Beginner
  • November 25, 2024

@Badger I can live with that! Do you know how I would do that? :)


Badger
Forum|alt.badge.img+5
  • New
  • November 25, 2024

@Hud_Rock You can use a Filter or a code block to achieve it.

A filter should be fine in this case as you have a binary choice. 

Look at the response from the form for you question and the choose the right information to set the filter condition.


If it gives you the response as yes or no true or false then use a condition like matches exactly (I think this is case sensitive so be careful).

From there you could send the request to book an appointment or not. 

You can learn more about Filters on Elena’s blog post here https://zapier.com/blog/filter-by-zapier-guide/

Hope that helps. Any questions do reach out.