We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

LiveSearch

Development and Programming

evan flows's avatar
evan flows
33 posts
20 years ago
evan flows's avatar evan flows

Has a plug-in been created for this?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
20 years ago
Lisa Wess's avatar Lisa Wess

No, but the above code works brilliantly, and is not difficult to implement.

       
evan flows's avatar
evan flows
33 posts
20 years ago
evan flows's avatar evan flows

LisaJill –”…and is not difficult to implement”

There is always an exception…I am getting a “error on page” message at the bottom of the browser as soon as I type anything into the Livesearch box.

Notes: 1) I use welcome.php, not index.php 2) I have the livesearch.js in the same directory as the welcome.php file 3) I changed the livesearch.js file to: liveSearchReq.open(“GET”, “./welcome.php/KB/livesearch?s=” + document.forms.searchform.s.value); 4) I have also unsuccessfully tried “/welcome.php/KB/livesearch?s=”

Thanks.

_______________________start Livesearch box template <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1” /> <title>Untitled Document</title>

<script type=”text/javascript” src=”livesearch.js”></script>

</head> <body>

<h4>Blog LiveSearch:</h4> <form onsubmit=”return liveSearchSubmit()” name=”searchform” method=”get” action=”/welcome.php”>

<input type=”text” id=”livesearch” name=”s” size=”15” autocomplete=”off” onkeypress=”liveSearchStart()” />

</form>

<div id=”LSResult” style=”display: none;”><div id=”LSShadow”></div></div>

</body> </html>

_______________________end Livesearch box template

       
Paul Burdick's avatar
Paul Burdick
480 posts
20 years ago
Paul Burdick's avatar Paul Burdick

Lisa is off moving today, so how about I help? Do you have a URL to look at?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
20 years ago
Lisa Wess's avatar Lisa Wess

Lisa has finished moving but is about to collapse in exhaustion for at least … 40 hours? Did you get this fixed? =)

       
evan flows's avatar
evan flows
33 posts
20 years ago
evan flows's avatar evan flows

LisaJill - no, this isn’t fixed yet.

I sent Paul the url page with the search box and he replied: “The only thing I can see that you are missing is onload=”liveSearchInit()” in your body tag. The paths look good and correct, and my browser says it loaded the javascript.”

Now I am confused – 1) do I need the {exp:search:simple_form weblog="news"} tag in my template? 2) If not, where is the “tag” that Paul is referring to?

Thanks for the follow-up.

       
Paul Burdick's avatar
Paul Burdick
480 posts
20 years ago
Paul Burdick's avatar Paul Burdick

I sent you back an email about this evan. The <body> tag is in your HTML.

       
evan flows's avatar
evan flows
33 posts
20 years ago
evan flows's avatar evan flows

Paul,

I added the onload=”liveSearchInit()” 1) below <body> - it displayed “live.SearchInit()” on the page and the “error on page” still appeared when I entered text into the search box 2) above </body> - ditto 3) after <body> and <form… - ditto

Thanks for your help

       
Chris Curtis's avatar
Chris Curtis
17 posts
20 years ago
Chris Curtis's avatar Chris Curtis

It should look like:

<body onload="liveSearchInit()">
       
Paul Burdick's avatar
Paul Burdick
480 posts
20 years ago
Paul Burdick's avatar Paul Burdick

Yes, like Chris has it, in the <body> tag.

       
evan flows's avatar
evan flows
33 posts
20 years ago
evan flows's avatar evan flows

Programming school is on my list of to-dos :}

I made the change to the <body> tag – but am still getting an “error on page” The warning icon said- line: 16 char: 1, error:object expected code:0

       
Paul Burdick's avatar
Paul Burdick
480 posts
20 years ago
Paul Burdick's avatar Paul Burdick

Try changing the call to the javascript file:

<script type=”text/javascript” src=”/livesearch.js”></script>

       
evan flows's avatar
evan flows
33 posts
20 years ago
evan flows's avatar evan flows

Things are improving – when I enter text into the box there is no “error on page” but as soon as I stop typing a second searchbox appears.

If I hit the enter key I get another flashed “error on page” message and an empty page opens.

       
Paul Burdick's avatar
Paul Burdick
480 posts
20 years ago
Paul Burdick's avatar Paul Burdick

In the JavaScript try making an absolute link as well:

liveSearchReq.open(“GET”, “/welcome.php/KB/livesearch?s=….etc.

       
evan flows's avatar
evan flows
33 posts
20 years ago
evan flows's avatar evan flows

Yes, this is what the javascript contains.

       
First 2 3 4 5 6 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.