Posting a form

Discussion in 'Javascript' started by emu, Apr 12, 2005.

  1. emu

    emu Guest

    Hi

    I have a form which is contained in a <div> in the template which
    searches our Intranet, Staff directory or Google. This form needs to
    work client side so I am using JavaScript and HTML no server code. It
    need to submit to itself for now

    I want the form to show the last value selected when they submit the
    form. It would be good to bring through the name that they were
    searching for as well.

    Any idea greatly appreciated.

    I have edited this code down to basics

    <div id="search">

    <script type="text/javascript" language="JavaScript">

    function ActionDeterminator()
    {
    f = document.selectSearchForm.searchme.selectedIndex;
    x = document.selectSearchForm.searchme[f].value;
    document.selectSearchForm.action=x

    if (f=1){


    document.selectSearchForm.name.value=document.selectSearchForm.queries_search_query.value
    }

    if (f=2){


    document.selectSearchForm.q.value=document.selectSearchForm.queries_search_query.value
    }

    return true;
    }

    </script>

    <form name="selectSearchForm" action="" method="get" onSubmit="return
    ActionDeterminator();" />
    <input type=hidden name=mode value=results />
    <input type=hidden name=name />
    <input type=hidden name=q />

    <strong>search</strong>&nbsp;
    <select name="searchme" onChange="return ActionDeterminator();">
    <option value="http://localhost/search2.html"
    name="Intranet">Intranet</option>
    <option value="http://localhost/search2.html"
    name="Staff directory">Staff directory</option>
    <option value="http://www.google.com/search"
    name="Google">WWW (Google)</option>
    </select>
    &nbsp;
    <input name="queries_search_query" type="text" value="" />
    <input type=hidden name=submit VALUE="Search" />
    <input type="image" alt="search" src="go.gif"
    value="Search" style="display:inline"/>
    </form>

    </div>
     
    emu, Apr 12, 2005
    #1
    1. Advertising

  2. emu

    kaeli Guest

    In article <>,
    enlightened us with...

    > I have a form which is contained in a <div> in the template which
    > searches our Intranet, Staff directory or Google. This form needs to
    > work client side so I am using JavaScript and HTML no server code. It
    > need to submit to itself for now
    >
    > I want the form to show the last value selected when they submit the
    > form.


    Like this one does?
    http://www.ipwebdesign.net/kaelisSpace/useful_parseUrl.html


    --
    --
    ~kaeli~
    If a turtle doesn't have a shell, is he homeless or naked?
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Apr 12, 2005
    #2
    1. Advertising

  3. emu

    M E Guest

    Just what I was looking for.

    I will need to get it to work as part of the template but it sends me on
    the right track.

    Thanks

    *** Sent via Developersdex http://www.developersdex.com ***
     
    M E, Apr 12, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Baker

    WebClient form Posting with form name?

    Jeff Baker, Aug 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    755
    John Saunders
    Aug 29, 2003
  2. alanb
    Replies:
    2
    Views:
    537
    alanb
    Apr 23, 2004
  3. Rob Meade
    Replies:
    0
    Views:
    427
    Rob Meade
    Dec 1, 2004
  4. AmitKu
    Replies:
    7
    Views:
    517
    John Timney \(MVP\)
    Jan 8, 2007
  5. Replies:
    3
    Views:
    660
Loading...

Share This Page