I'm trying to get two autocomplete search scripts working on my site. One should take the user input in the business categories field and lookup values for the drop down list. The other should do the same in the business names field.

I'm not too strong on javascript but think I am pretty close. However I am having problems getting the two to work at the same time. The categories script is trying to lookup using the names value and vice versa.

Suspect it's something to do with the this.value but would appreciate any help putting this right.

Many thanks in advance.

arthur_negas
—
2010-05-23T19:54:56Z —
#2

Appreciate the feedback - as stated not too strong on Javascript but can see what you are getting at. Will revise to your advice and hopefully fix.

Zarin_Denatrose
—
2010-05-22T09:24:30Z —
#3

It would help if you could show the page that these are on so the conflict can be more easily traced. If these are running on the same page, the answer is pretty evident: You're calling the same function from both and passing in a value without a way to differentiate between which search method should be called.

What I recommend doing is making one lookup function that also takes the type of lookup being done, and pass both those values to your php script.

If these are working separately on different pages, but returning the results of each other, then the issue is probably in the PHP. Check to make sure you're using the right queries for the right post variables (ie, verify that searchcat looks at the category data and searchname looks at the name data.)