Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3976120
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:45:59+00:00 2026-05-20T04:45:59+00:00

I hoping for a tiny bit of help. I have setup a form which

  • 0

I hoping for a tiny bit of help.

I have setup a form which pulls the value from #keyword and submits it as the url.

The page is http:// mysite.com /tags

I am having two problems:

  1. The .toLowerCase isn’t working
  2. The url updates though it adds the name of the keyword input (which is keyword) like so: http:// mysite.com/tags?keyword=MYKEYWORD

I would like io to look like this instead:
http:// mysite.com/tags/mykeyword

This is the code I have so far:

$(document).ready(function() {
     $('#tag-search').click(function() {
          goUrl = http://mysite.com/ + $('#keyword').val().toLowerCase();
          window.location = goUrl;
     });
});

and the form:

<form id="tagForm" class="uniForm">
<fieldset class="inlineLabels">
    <div class="ctrlHolder">
        <label for="keyword">Tag Keyword</label>
        <input id="keyword" name="keyword" value="" size="35" class="textInput required" type="text" />
        <p class="formHint">Add your tag keyword and hit submit</p>
        </div>
    <div class="buttonHolder"><button type="submit" id="tag-search" class="primaryAction">Submit</button></div>
</fieldset>
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:46:00+00:00Added an answer on May 20, 2026 at 4:46 am

    Your form is currently doing the default behaviour – i.e. GETting the current URL (because you haven’t specified an action or method), with query string parameters pulled from values entered into the form.

    To stop the default behaviour, you need to make sure you return false from your events handlers:

    $(document).ready(function() {
         $('#tag-search').click(function() {
              goUrl = 'http://mysite.com/' + $('#keyword').val().toLowerCase();
              window.location = goUrl;
              return false;  // Prevent the default button behaviour
         });
         $('#tagForm').submit( function() {
              return false;  // May be necessary to prevent the default form behaviour
         });
    });
    

    As others have also identified, you need to wrap the base site url in quotes when you assign it to goUrl, to make sure that it is treated as a string.

    Update It is probably advisable to move your redirect logic from the button’s click handler to the form’s submit handler, as Stofke suggests:

    $(document).ready(function() {
         $('#tagForm').submit( function() {              
              goUrl = 'http://mysite.com/' + $('#keyword').val().toLowerCase();
              window.location = goUrl;
              return false;  // Prevent the default form behaviour
         });
    });
    

    Keep in mind that there are other ways to submit your form besides clicking on the Submit button, such as hitting the Enter key inside a text box – using your implementation, when the user hits Enter inside the Keyword text box, they’ll still end up at http:// mysite.com/tags?keyword=MYKEYWORD rather than http:// mysite.com/tags/mykeyword.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hoping you guys can help me out. I have a dynamic url and I
im hoping someone can help me quickly with a question i have. As site
I have an equation that is only a tiny bit too wide for one
hoping to get some help here. I have locations on a database that I
Hoping someone can help me design this correctly. In my TCP code, I have
Hoping someone can help a new iOS developer out - I have a ready
Hoping someone can help me out with some pretty erratic behaviour from omnicomplete in
Hoping someone can help me out with this. Lets say I have a table
Hoping I might be able to get some help with an infuriating problem which
Was hoping for some fresh eyes on this. I've got a page which will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.