That would be very cool...

First you have to capture the onKeyPress Event for the input box...

<input type="text" name="q" onKeyPress="onKeyPressHandler(this.form)">

now write a function that handles it

<script>
function onLoad() {
        query = new Array("bob", "bill", "bottom", "big");
        results = new Array();
        query = results;
        build_search_results();
}

function onKeyPressHandler(obj) {

        var result_index = 0;
        //match whats in the form and then anything after it
        var r = new RegExp(obj.q.value + "+", "g");
        for (var i = 0;i<query.length;i++) {
                var match = query[i].match(r);
                if (match.length > 0) {
                        //add to the results list
                        results[result_index] = obj.q.value;
                        result_index++;
                }
        }
        update
}

function build_search_results() {
        var out = "";
        for (var i=0;i<results.length;i++) {
                out += results[i] + "<BR>";
        }
        //this part will only work on IE, there may be a way to do it cross browser
        search_results.innerHTML = out;
}
</script>
<div id="search_results"></div>

Not sure if this will actually work, because I just wrote it off the top of
my head... Let me know if it works, if not, it's a good start.

______________________________________________
Pete Freitag ([EMAIL PROTECTED])
CFDEV.COM / NETDesign Inc.
ColdFusion Developer Resources
http://www.cfdev.com/


-----Original Message-----
From: Kevin Langevin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 12, 2000 6:04 PM
To: [EMAIL PROTECTED]
Subject: Narrow-down search...


I'm trying to find the best way to create a search routine that allows me to
"narrow-down" the choices as the user types.  SOrt of like what Microsoft
Help does.  If I have a query of 50 items, and the user types a "b", then
everything that starts with "b" is left, but everything else is parsed out.
If they then type an "a", then everything starting with "ba" is left, and
everything else is parsed out.

I've downloaded CF_combosearch, and it's SORT of what I'm looking for,
except I'm trying to avoid having to click on a button to submit the search.
I want it to update with each keypress. I'm not a Javascript wizard by a
longshot, but it seems to me that there should be some way to do this
client-side, without re-submitting the form, using javascript.

Has anyone else ever written something like this?  If not, are there any
javascript gurus who can help coach me through doing it myself?

<CFUG-SFL Manager>
-Kev
</CFUG-SFL Manager>

> -----Original Message-----
> From: Brian Thornton [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 12, 2000 3:12 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Encrypting CF files
>
>
> cfencrypt is in the in dicectory.. Decrypt can only work in some cases...
>
> -Brian
> ----- Original Message -----
> From: J.Milks <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 12, 2000 12:45 PM
> Subject: Encrypting CF files
>
>
> > Hi All,
> > I am working on an existing project with encrypted CF templates. My
> question
> > is twofold:
> >
> > 1- How do I encrypt templates? I cannot find anything in the help. I
> suspect
> > it is an exe or something.
> >
> > 2- I am also told that there is a DECRYPT exe floating around
> as well. Is
> it
> > widely available, or is it one of those
> > tools nobody admits to having?
> >
> > Thanks,
> >
> > James
> >
> >
> >
> >
> >
> >
> --------------------------------------------------------------------------
> ----
> > Archives: http://www.mail-archive.com/[email protected]/
> > To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> >
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
_talk or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to