Search form code with options and hidden filed problem

Discussion in 'JavaScript' started by emb, May 15, 2010.

  1. #1
    Hello,

    I am hoping someone can help me with following search form.

    As you can see I have created a form but I don't know how to fix the coding so when a user select a category it will add a different hidden filed for that option for example:
    When the user selects category "Men" the hidden filed
    <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://men.com/acatalog/">
    Code (markup):
    automaticly will be added to the search



    and when the user selects category "Kids" the hidden filed
    <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://kids.com/acatalog/"> 
    Code (markup):
    automaticly will be added to the search



    and so on...

    Here is my form coding I am using:
    <form name="simplesearch" method="get" action="" onsubmit="ssite=document.getElementById('sitelist');this.action=ssite.options[ssite.selectedIndex].value;return true;">			
     		<input type="hidden" name="page" value="search" />
            <input type="hidden" name="PR" value="-1" />
            <input type="hidden" name="TB" value="A" />
            <input type="hidden" name="NOLOGIN" value="1" /><input align="top" class="main_search_box" name="SS" type="text" value="search for ..." onfocus="this.value='';">
    Search within: 
    <select id="sitelist">
    <option value="">Select Catagory</option>
    <option value="http://kids.com/cgi-bin/ss000001.pl">kids</option>
    <option value="http://men.com/cgi-bin/ss000001.pl">men</option>
    <option value="http://women.com/cgi-bin/ss000001.pl">women</option>
    </select><input type="submit" class="button" name="ACTION" value="Go!">
    </form>
    
    Code (markup):
    Also I have one more question how do I make the "Select Catagory" a Must Choose and if not chosen to give message that say"Please Select a Category"


    Thank you in advance for any help you can give me...
    I am a bigginer so please go easy on me :)
     
    emb, May 15, 2010 IP