Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

71
Views
Redirect a HTML form and add value from input

I have form where I need to redirect to a new url, and add the value from the input to the new URL

<form action="https://test.test.com/" method="GET">
  <fieldset>
    <legend>bftl</legend>
    <input type="text" name="trackTrace" id="trackTrace" placeholder="Add your Track & Trace">
    <label for="month">Track & Trace</label>
    <input type="submit" class="submit" value="Submit">
  </fieldset>
</form>

After you have enter the Track & Trace number and pressed the submit button you shall be redirected to "https://test.test.com/#/TRACK&TRACENUMBER" in a new tab

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

You need js code like this:

<form action="https://test.test.com/" method="GET" onSubmit="return submitForm()">
  <fieldset>
    <legend>bftl</legend>
    <input type="text" name="trackTrace" id="trackTrace" placeholder="Add your Track & Trace">
    <label for="month">Track & Trace</label>
    <input type="submit" class="submit" value="Submit">
  </fieldset>
</form>
<script>
function submitForm() {
    location.href="https://test.test.com/#/TRACK&"+document.getElementById("trackTrace").value;
    return false;
}
</script>
7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.