need some help with my search box please ...

This is a discussion on "need some help with my search box please ..." within the JavaScript Forum section. This forum, and the thread "need some help with my search box please ... are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 30th, 2006, 21:18
New Member
Join Date: Aug 2006
Location: sdssds
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
need some help with my search box please ...

Hi all, i would like some help with something if you would be so kind. I posted this in the php thread but was told (on another forum) that it is a javascript solution thats needed.
"make the onchange event of your select box call a js function that validates the selected value, changes the action of the form, and submits"
Basically,
I have this search box in my header ..


With this code.
<div style="padding:5px;">
<form method="get" action="http://www.xxxxxxx.com/yyyyyy/">
<table style="width:50%;" cellpadding="5">
<tr>
<td style="vertical-align:top;font-size:9pt;">
input type="text" value="search ..." id="search" onkeyup="searchSel()">
<SELECT id="groups">
<option value="">Select:</option>
<option value="user">Users</option>
<option value="event">Events</option>
<option value="gallery">Gallery</option>
</select>
<input type="submit" value="Go" class="mainmenu66" onmouseover="this.className='mainmenu77';" onmouseout="this.className='mainmenu66';"
</div>
</td>
</tr>
</table>
</form>

And am trying to do 2 things.
1. Remove the 'go' button, and have it execute the search when the user selects an option from the drop down box.
2. The 'action' of the form to goto a different place depending on the users selection within the drop down box -
So; if they select 'Users'.. it goes to xxxxxx.com/searchusers, if they select events it goes to xxxxx.com/searchevents etc.
Can anyone give me some ideas/code as to how i can implement this, Or, if anyone has some example code or something to help me along that would be awesome too? Have't had much luck with google when i searched for stuff ... my javascript knowledge is limited to a single university assignment so not very good, but not 100% noob .. just 90% hehe .
Thanks to any and all who input into the thread
Ric
Reply With Quote

  #2 (permalink)  
Old Aug 31st, 2006, 10:46
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: need some help with my search box please ...

Try this:

1. Initially have the action attribute empty - action=''.

2. Set up an 'onchange' function for your select box, e.g., 'onchange = gosearch();'.

3. Within this function do:
.... check for the value selected
.... set action accordingly using - document.form.action = 'actionrequired';
.... submit using - document.form.submit();
Reply With Quote
Reply

Tags
help, search, box

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Engines NewDesigner Search Engine Optimization (SEO) 14 Mar 7th, 2008 14:04
Search Box parkerscroft Starting Out 2 Mar 2nd, 2007 15:58
Search Analyst/Account Executive/SEO/PPC/CPC/Search Engine Optimisation/Pay per Click/London Web JobBot Job Opportunities 0 Nov 22nd, 2006 10:20
SEO/PPC/Search Engine Optimisation/Pay Per Click/Campaigns/Online/Marketing/Agency/Analyst/Search/Manager/Executive/Manchester Web JobBot Job Opportunities 0 Nov 17th, 2006 11:11
PHP Search systems that will search mysql bohboh PHP Forum 3 May 10th, 2006 09:52


All times are GMT. The time now is 01:20.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43