View Full Version : HREF onclick in search form

Nov 4th, 2010, 09:34 PM
I'm trying to figure out how to add a typed search variable to the end of a url string with the follow code:

<form action="" id="search-form">
<div class="rowElem"><strong>
<input type="text" value="Enter Artist, Team, or Venue"></strong>
<a href="#" onclick="document.getElementById('search-form').submit()"> <span><span>search</span></span></a></div>

The URL would be something like Results.html?kwds='whatever searched'

I've tried everything

Nov 5th, 2010, 12:17 AM
Your form is not complete enough to do what you want. Here is a more complete one that works. It doesn't involve any javascript but you can add javascript, php or whatever to act on the changed URL.
<form action="" method="get" id="search_form" name="search_form">

<input type="text" value="Enter_Artist" name="myform">

<input type="submit" value="Search">