Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-10-2005, 08:07 PM   PM User | #1
cichlid
New to the CF scene

 
Join Date: Sep 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
cichlid is an unknown quantity at this point
Ajax event problem

Hi All,
Please excuse my ignorance. This is my first ever bit of DOM/JavaScript coding...

I am modifying an Ajax livesearch script. At the moment it correctly passes $q to the PHP search script, but does not pass $submitted or $database unless the user hits submit.

I would like to offer the ability to search a specific database ($database) so the value of the select gets passed across to the script. Unfortunately, I haven't the foggiest idea how to do this.

Any ideas/pointers would be extremely grateful!

Many thanks!



<form action="livesearch_results.php" method="GET" target="searchWindow">
<input type="hidden" name="submitted" value="submit"/>

<input type="text" name="q" id="q" size="15" onkeyup="loadXMLDoc('livesearch_results.php?q='+this.value)" style="width:250px; " />


<select name="database">
<option value="news">in news</option>
<option value="articles">in articles</option>
<option value="glossary">in glossary</option>
<option value="directory">in shop finder</option>
<option value="backissues">in back issues</option>
</select>
cichlid is offline   Reply With Quote
Old 09-12-2005, 07:01 PM   PM User | #2
zeke donetello
New to the CF scene

 
Join Date: Sep 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
zeke donetello is an unknown quantity at this point
<input type="text" name="q" id="q" size="15" onkeyup="loadXMLDoc('livesearch_results.php?q='+this.value)" style="width:250px; " />
would become
<input type="text" name="q" id="q" size="15" onkeyup="buildParamList(this);" style="width:250px; " />

Code:
function buildParamList(obj)
{
var url = 'livesearch_results.php?q=' + obj.value;
var db = "&database=' + document.getElementById('database').value;

loadXMLDoc(url)
}
You need to ad the id tag to the database select control.

This is just a general idea of how you could do it, hope it helps.
zeke donetello is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 09:40 AM.


Advertisement
Log in to turn off these ads.