SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    Senior Webdesigner koolbrian's Avatar
    Join Date
    Dec 2000
    Location
    Mauritius
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey,
    i would like to know, with a search (text) box, and with a drop menu, how can when a user drop down menu and choose another site, it changes the search to this site. Understand, very difficult to explain.... like yahoo.When u make a search, then, you can choose to search, in all categories, or just the one categorie ?,

    for exemple

    <form action="http://www.vstore.com/cgi-bin/pagegen/Vstorestuff/areacool/page.html" method="GET">, and when the user select Gifts from the drop down menu, it search in
    <form action="http://www.vstore.com/cgi-bin/pagegen/Vstoregifts/areacool/page.html" method="GET">



    understand?
    the two (text and drop down menu) are in relation



    Brian

  2. #2
    Senior Webdesigner koolbrian's Avatar
    Join Date
    Dec 2000
    Location
    Mauritius
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why does anyone reply,
    maybe u don't understand, please tell me.I thought at least one reply


    Brian

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2001
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't have an aswer for this, but I'd like some help with this too.. I have a Search box on my main page, and I've been trying to get it to search my vbulletin board. So basically I want to be able to type "anything" in my search box on my main page, and then have it search my vbulletin board for that keyword. Can anyone help at all? I've tried all kinds of combinations of code. And also the actual <FORM> tab puts in a space underneath my search box that I do not want there..

  4. #4
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's some code using JavaScript to dynamically submit the form to a page, depending on what was selected in the select menu. This example assumes the pages you're submitting to are on your own site. It would get more complex if you want to search different sites (i.e. Google, Yahoo, Download.com, etc.), because they use different names for their input field, which is used on the query string. Google uses the name 'q' for their search field, while Yahoo uses 'p', so their query strings are different:

    http://www.google.com/search?q=cheese
    http://search.yahoo.com/bin/search?p=cheese

    This JavaScript could of course be altered to search on different sites, using the correct field name (p, q, or whatever).

    Code:
    <html>
    <head>
    	<title>Dynamic Form Action</title>
    	
    <script language="JavaScript">
    <!--
    
    function getAction() {
      formAction = document.myForm.myMenu[document.myForm.myMenu.selectedIndex].value
      document.myForm.action = formAction
    }
    
    // -->
    </script>
    	
    </head>
    
    <body>
    <form name="myForm" method="get" action="" onSubmit="getAction();">
    
    <input type="text" name="searchField"><br>
    
    <select name="myMenu">
    <option value="example_1.html">Example 1</option>
    <option value="example_2.html">Example 2</option>
    </select>
    
    <input type="submit" name="submit" value="Search">
    
    </form>
    
    </body>
    </html>

  5. #5
    Senior Webdesigner koolbrian's Avatar
    Join Date
    Dec 2000
    Location
    Mauritius
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, i can't handle it anymore,
    i was trying to put two options
    vstorestuff and
    vstoregifts, could u please do it for me, i tried for hours, and it never worked!



    <form action="http://www.vstore.com/cgi-bin/pagegen/Vstorestuff/areacool/page.html" method="GET">
    <input type="hidden" name="file" value="/page/search/searchresults.spl">
    <input type="hidden" name="mode" value="search">
    <input class="keywords" name="search" size="20">
    <input class="submit" type="submit" value="Search" name="Search">
    </form>


    and this




    <form action="http://www.vstore.com/cgi-bin/pagegen/Vstoregiftsf/areacool/page.html" method="GET">
    <input type="hidden" name="file" value="/page/search/searchresults.spl">
    <input type="hidden" name="mode" value="search">
    <input class="keywords" name="search" size="20">
    <input class="submit" type="submit" value="Search" name="Search">
    </form>




    could u please put those two in the drop down menu and Make it work, eventually!


    Brian

    THANX!

  6. #6
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried for hours? The posts are only two hours apart!

    Code:
    <html>
    <head>
    	<title>Dynamic Form Action</title>
    	
    <script language="JavaScript">
    <!--
    
    function getAction() {
      formAction = document.myForm.myMenu[document.myForm.myMenu.selectedIndex].value
      document.myForm.action = formAction
    }
    
    // -->
    </script>
    	
    </head>
    
    <body>
    <form name="myForm" method="get" action="" onSubmit="getAction();">
    
    <input type="text" name="searchField"><br>
    
    <select name="myMenu">
    <option value="http://www.vstore.com/cgi-bin/pagegen/Vstorestuff/areacool/page.html">VStore Stuff</option>
    <option value="http://www.vstore.com/cgi-bin/pagegen/Vstoregifts/areacool/page.html">VStore Gifts</option>
    </select>
    
    <input type="submit" name="submit" value="Search">
    
    </form>
    
    </body>
    </html>
    To put more options in, use the following :-
    Code:
    <option value="http://LINKADDRESS">LINKTITILE</option>
    Custom coder, at your service
    Well, I stole Scrubz' code and modified it for you but the best way to learn anything koolbrian is to do it yourself.

    There are PLENTY of Javascript resources that tell you how to do things like this. Search on Google for JavaScript and you'll get about a hundered thousand

    See ya,

  7. #7
    Senior Webdesigner koolbrian's Avatar
    Join Date
    Dec 2000
    Location
    Mauritius
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey KMXRetro

    Tried for hours? The posts are only two hours apart!

    One hour for me is 60 mins and YOU ?,
    This post was here for more than 180 mins!,


    Brian

  8. #8
    Senior Webdesigner koolbrian's Avatar
    Join Date
    Dec 2000
    Location
    Mauritius
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i tried, and tried again, in vain,


    with the last code u gave me,
    it searches for nothing. i mean as if u press search, and no0thing was in the text box! Why ?

    this is the good script that works


    <form>
    <form action="http://www.vstore.com/cgi-bin/pagegen/Vstorestuff/areacool/page.html" method="GET">
    <input type="hidden" name="file" value="/page/search/searchresults.spl">
    <input type="hidden" name="mode" value="search">

    <input type="text" name="search" size="20">
    <input type="submit" value="Search" name="Search">
    </form>


    The ones that are colored have disapea in the code u gave me Retro!. Is that the source of the problem ?,
    i've tried with/without them, still nothing!, Is there another javascript for it ?,


    I've search but it gave me the code that u gave me, e.i bad one!



    Brian

  9. #9
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Explain again EXACTLY what you want the script to do and I'll have a look and see what I can come up with. You aren't making yourself that clear.

  10. #10
    Senior Webdesigner koolbrian's Avatar
    Join Date
    Dec 2000
    Location
    Mauritius
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok,
    i am trying to make a search through my store[S]. But i should put many search boxes to search the in Different stores. As the search boxes will be at the right hand side of my site, there isn't enough space. SO,
    i imagined of doing ONE search text box, with ONE drop down menu to choose from the different stores to search. and when a user choose (for exemple) gifts in the drop down menu, it searches the text he inserted in the text box, around the store he chose from the drop down menu!.,
    Simple. and the code that Scrubz gave me was the one i was looking for. But there is a problem. I changed the link of the <option value> tag with the ones of my store. In vain. It doesn't work!, well it works, but when i search (for exemple) "flowers", it was as if it searches for NOTHING, as if u typed nothing.
    Have a look at
    http://www.areacool.f2s.com/search.html

    and u'll see in concrete my explanation.



    The GOOD code that works at searching my store is


    <form>
    <form action="http://www.vstore.com/cgi-bin/pagegen/Vstorestuff/areacool/page.html" method="GET">
    <input type="hidden" name="file" value="/page/search/searchresults.spl">
    <input type="hidden" name="mode" value="search">
    <input type="text" name="search" size="20">
    <input type="submit" value="Search" name="Search">
    </form>






    . I think we should put in relation both of them, so as to insert well the code.
    and also i think that the code colored in blue should be seen in the one of the drop down menu search.!!!!



    Hope u understood


    Brian


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
  •