Adding a Flare Search Bar to the Software

This forum is for all Flare issues not related to any of the other categories.
Post Reply
mymojo
Propeller Head
Posts: 28
Joined: Thu Aug 28, 2008 4:12 pm

Adding a Flare Search Bar to the Software

Post by mymojo »

Hey guys,

Has anybody implemented a search bar in the actual software product being documented that opens your help and lands the user on the search results?

There's in-documentation search capabilities, but what about searching an online Flare manual from a different start point? Any developers know of a code snipped that would do this?

I'm picturing my user in the software, and there's a search bar somewhere in the software interface where they can type a question and it opens up an internet browser straight to the Flare manual's search results.

Thanks!
Shannon
GregStenhouse
Sr. Propeller Head
Posts: 330
Joined: Tue May 13, 2008 3:27 pm
Location: Christchurch, New Zealand

Re: Adding a Flare Search Bar to the Software

Post by GregStenhouse »

It looks like (for HTML5 output, no sure about others) the search URL is #search followed by a dash and then the search query. So I imagine it would't be too hard to have a box in the software that captures the input (e.g. "my search query") then crafts a link like:
https://myserver/help/search-my%20search%20query
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding a Flare Search Bar to the Software

Post by NorthEast »

mymojo wrote:Has anybody implemented a search bar in the actual software product being documented that opens your help and lands the user on the search results?

There's in-documentation search capabilities, but what about searching an online Flare manual from a different start point? Any developers know of a code snipped that would do this?
Yes, I have a search box for the help in our application.

HTML in master page:

Code: Select all

            <form name="help-search" id="help-search-form" class="clearfix">
                <input type="search" id="help-search-input" name="helpSearchInput" placeholder="Search our help" autocomplete="on" form="help-search-form" />
                <button type="submit" id="help-search-button">Search</button>
            </form>
Javascript - this uses jQuery:

Code: Select all

$(document).ready(function() {
		/* handle help search box submit */
		$( "#help-search-form" ).submit(function(event) {
			event.preventDefault(); /* prevent default action, so doesn't refresh */
			var searchFor = $('#help-search-input').val(); /* get value in input box */
			var searchurl = 'http://yourwebsite.com/yourhelp/default.htm#search-' + searchFor; /* build URL */
			window.open(searchurl, "_blank");	 /* open results in new window */
			$('#help-search-input').val(''); /* clear input box */
		});
});
So this will take the text entered in the form, and then use that to open the following URL:

Code: Select all

http://yourwebsite.com/yourhelp/default.htm#search-<search term>
Post Reply