Form search submission help
Hey guys, I have a form and there are 4 buttons possible for the user to click to submit. One 开发者_如何学编程searches for everything, another for users, another for clips, and the fourth for topics. Now my question is that the buttons has name=category and value=(type of search) and what I intend to do is send the user to the search result page with the category=value in the address bar(using GET method). This is working fine on firefox but it isn't working at all using google chrome. Any help? Here's the code:
<form method="get" action="search.php" name="search" onsubmit="return Validate();">
<input type="text" class="searchit" title="Search..." name="search" id="search" /><br/>
<label><span> </span> <input name="submitter" type="submit" value="Search" class="searchsubmitButton" id="submitter" /></label>
<span class="searchfor">Search for:</span>
<label><span> </span> <input name="c" type="submit" value="Users" class="searchsubmitButton" id="submitter" /></label>
<label><span> </span> <input name="c" type="submit" value="Clips" class="searchsubmitButton" id="submitter" /></label>
<label><span> </span> <input name="c" type="submit" value="Topics" class="searchsubmitButton" id="submitter" /></label>
</form>
because your input fields are inside the <label></label>
tags ?
Take a look at this thread: Safari and Chrome back button changes hidden and submit values in forms
The easiest solution I can think of is for you to create a hidden field called "c". Then, when the submit button is clicked, set the value (Users, Clips or Topics) in "c" hidden field first before submitting the form.
精彩评论