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 8479989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:11:13+00:00 2026-06-10T19:11:13+00:00

Ok so this should be a fairly easy thing to do however I think

  • 0

Ok so this should be a fairly easy thing to do however I think I am missing something. I have an input field like so.

<input id="jobSearchField" class="searchField" runat="server" 
onkeypress="javascript:GoToFunc(event, this.value)" type="text" 
onfocus="if (this.value == 'Seach jobs by JobID, JobTitle, Keywords, or Location') this.value=''" 
value="Seach jobs by JobID, JobTitle, Keywords, or Location" />

I also have a button to the right like so.

<button id="filterSubmit" runat="server" class="filterSubmit">Submit</button>

Here is my javascript that I “attempted” to build.

<script type="text/javascript">
    function GoToFunc(e, value) {
        if (e.keyCode == 13) {
            var location = document.location.href + "&query=" + value;
            document.location.href = location;
            document.open();
        }
    }
</script>

My javascript function that I “attempted” to build was suppose to pass that query string back into the url so that I could parse what the user wanted. I am using ASP.NET and C# for the language.

So the question is how do I return back in the url as a parameter what the user typed?

  • 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-06-10T19:11:14+00:00Added an answer on June 10, 2026 at 7:11 pm

    First off you are recreating what a form does. If you had just a form it would work.

    For your code, stop the enter keys action by returning false. You need to add return to the event handler too. This also expects that the querystring value is not there already.

    <input id="jobSearchField" class="searchField" runat="server" 
    onkeypress="return GoToFunc(event, this.value)" type="text" 
    onfocus="if (this.value == 'Seach jobs by JobID, JobTitle, Keywords, or Location') this.value=''" 
    value="Seach jobs by JobID, JobTitle, Keywords, or Location" />
    
    
    
    <script type="text/javascript">
        function GoToFunc(e, value) {
            if (e.keyCode == 13) {
                var newLocation = window.location.href + "&query=" + encodeURIComponent(value);
                window.location.href = newLocation;
                return false; //stop event key
            }
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with something that should be fairly easy I think. I have a
I think this should be fairly easy but I'm not familiar with how it's
OK, this sounds simple and or like something that should have probably been done
This seems like it should be fairly simple, but for some reason I can't
I have a fairly easy SQL task at hand and I'd like validation (or
This should be fairly easy. I'm following along with a fairly outdated video course
I have a form where fields get added via JavaScript. This is fairly easy
It feels like this should be fairly simple but nothing i've tried so far
I know this should be fairly easy but I can't quite figure it out
This should be fairly easy, but I'm getting a headache from trying to figure

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.