SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2004
    Posts
    419
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form Submit Query

    I would like to create a form which allows users to enter a search string, and for the search string to be appended on to the end of this URL:

    http://www.oracle.com/pls/db92/print...h_string=BUYER

    Where 'BUYER' in the example above would be replaced by whatever they type in the search form.

    Of course, if I had the URL of the search form, I could hack that up. But all I have is the URL above - I can't actually find the search form.

    This is what I would like to do:

    1. User enters search string (e.g. APPROVE)
    2. User submits form
    3. Form takes this URL "http://www.oracle.com/pls/db92/print_hit_summary?search_string" and appends the value from the form onto the end of the URL

    I could do this easily if I had access to a server-side scripting language, but since I don't, I wanted to see if I could do this using JavaScript.

    Thanks

    Jim

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <form method="GET" action="http://www.oracle.com/pls/db92/print_hit_summary">
    <input type="text" name="search_string" /><br />
    <input type="submit" name="SUBMIT" />
    </form>
    Why won't that work? Why do you even need a server-side script or JS?
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2004
    Posts
    419
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry - I should have said that I tried that before.
    It returnns an Error Page 404 on the Oracle Site.

    But - if you just go direct to the URL I put in my first post, and replace 'BUYER' with 'APPROVE' or anything else, the search works.

    I was hoping to create a form to take the input from a text field, and append that to the end of this URL:

    http://www.oracle.com/pls/db92/print...search_string=

    If I was using ASP I could do this:

    Code:
    text_input = request.form("text_input")
    URL = "http://www.oracle.com/pls/db92/print_hit_summary?search_string=" & text_input
    response.redirect URL
    But I don't have access to ASP at work. Hence seeing if I could do it using Javascript.

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    See if this works for you.

    Code:
    <HTML>
    <HEAD>
    <TITLE>Oracle Test</TITLE>
    <script type="text/javascript">
    function gotoURL (el) {
    	var val = el.elements[0].value;
    	url = "http://www.oracle.com/pls/db92/print_hit_summary?search_string=" + val;
    	window.location = url;
    	alert ("Please wait for the page to load in the background before closing this alert");
    
    }
    </script>
    </HEAD>
    
    <BODY>
    <form action="" onsubmit="gotoURL (this)">
    <input type="text" onchange="this.form.submit()">
    </form>
    </BODY>
    </HTML>
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    SitePoint Evangelist
    Join Date
    Dec 2004
    Posts
    419
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much Ian. That has worked.
    Thanks for your time.
    Jim


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •