# Custom routing

You can use JavaScript to dynamically select a form endpoint.

Using this technique, you can use a drop-down to dynamically route submissions to a specific team, department, inbox, webhook, etc...

<form id="my-form" action="https://submit-form.com/sales-form-id" method="POST">
  <label for="department">Department</label>
  <select id="department" onchange="onChange(this)">
    <option value="sales" selected>Sales</option>
    <option value="marketing">Marketing</option>
    <option value="hr">HR</option>

  <label for="message">Message</label>
  <textarea id="message" name="message" required></textarea>
  <button type="submit">Send</button>

  onChange = function (event) {
    let action;
    switch (event.value) {
      case "sales":
        action = "https://submit-form.com/sales-form-id";
      case "marketing":
        action = "https://submit-form.com/marketing-form-id";
      case "hr":
        action = "https://submit-form.com/hr-form-id";
    document.getElementById("my-form").action = action;