Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Jump to search term in a query output...

New Here ,
Mar 13, 2009 Mar 13, 2009
Hi,

I have the results of a query outputted in a table. Depending on the user, this can be a longish query - maybe 100+ results. All these results have a checkbox next to them. The user checks the records they need to select, then submits the form to take that list of records in the "check" variable to another page which processes it.

What I'd like to be able to do is provide a search box on top of this table, for the user to type in a search term in the record they want to find. Then, I'd like the page to jump down to that record so the user can check it. But here's the kicker - I don't want to lose any other already-checked boxes. So the form variable needs to persist, even if this is done multiple times.

Any ideas on how this might be accomplished? I don't mind if the search has to be tied just to one field, etc. And I'm not asking anyone to write the code for me. Just point me in the direction of the right technique/technology, if ya can.

Thank you!
468
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 15, 2009 Mar 15, 2009
Hi,

It might be worth checking out some of the Ajax libraries for this. jQuery ( http://jquery.com) has a plugin called ScrollTo ( http://plugins.jquery.com/project/ScrollTo) that lets you easily scroll to a specific position or element (or other) item on a page. The developer has more details on his site ( http://flesler.blogspot.com/2007/10/jqueryscrollto.html).

You could use the ScrollTo plugin in concert with one of the Auto Complete plugins for jQuery (one of them: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/).

Hope that helps get you started.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2009 Mar 15, 2009
I knew it was gonna be Ajax / Java. I suck at Java. ;-)

Looks like it's time to get up to speed with it though, because that looks like it'll do the trick. I'll either have each record create an anchor with the value of the user's last name or something, or maybe I can make each one an object? I'll see what I can figure out.

Thanks for the pointer!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 16, 2009 Mar 16, 2009
StearmanDriver wrote:
> I knew it was gonna be Ajax / Java. I suck at Java. ;-)
>

Or you could just have the user use the search functionality already
built into the browser. I prefer the hand Firefox one that appears in
the bottom bar of the window, but I.E. works fine too, if with more clicks.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 16, 2009 Mar 16, 2009
LATEST
Ian Skinner wrote:
> Or you could just have the user use the search functionality already
> built into the browser. I prefer the hand Firefox one that appears in
> the bottom bar of the window, but I.E. works fine too, if with more clicks.

...*handy* FireFox one...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 16, 2009 Mar 16, 2009
Bear in mind that it's JavaScript you'll be writing and not Java, which is better since JavaScript is markedly easier than Java :)!

As you're outputting each record, you can use an anchor tag, certainly, but you can also assign a unique ID attribute to each element dynamically.

For example:
<cfoutput query="myquery">
<li id="elem#myquery.CurrentRow#_#myquery.lastname#">#myquery.field#</li>
</cfoutput>

Good luck and have fun!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources