FW: dynamic search of custom field

Thanks Matt,

I’ll check out the auto-complete functionality and see if that floats my
boat :), not adverse to other ideas at this time though. My interest in
the search field producing input for the sql query is mainly because I’m
familiar with it, using it in the past as a php/javascript solution to this

I like to feel like I can think outside the box but being semi-literate in
perl and new to RT code structures I never would have thought of your
solution.From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu]
Sent: Thursday, May 14, 2015 9:21 AM
To: mlind@sosml.net
Cc: rt-devel@lists.bestpractical.com
Subject: Re: [rt-devel] dynamic search of custom field

Hi Mike,

I have installed version 4.2.10.

I imported and updated the older (version 3.8.4) RT database.

So far all seems to be working fine.

I have a custom field on my Ticket/Create.html page (Customers) which
is a ‘Select one value’ Select box, is loaded using a package
(RT::CustomFieldValues::Customers) located in
rt4/local/lib/RT/CustomFieldValues and contains a very large number of

What is very large? ~K, ~10K, ~100K, etc?

I have added a text box above this select box (named ‘Search
Customers’) and would like to modify the contents of the select box each
time the “keyup”
event is fired for this text box; and base the query which loads the
select box with a where clause similar to "where customer_name like

There is an autocomplete CF - “Enter one value with autocompletion”.
Both for selecting single or multiple values. Perhaps give that a try?

I just can’t find out what I need to do to

  1.  reload the Ticket/Create page on the 'Select Customers' keyup



I would avoid reloading the page.

  1.  pass the text box content (value) to the query in


If you aren’t sold by the shear ease of the “Enter one value with
autocompletion” CF solution mentioned above and want to stick with a text
field and a select box populated via ajaxy events on that text field then
I’ll make a stab at a suggestion. Keep in mind there are a bunch of ways to
tackle this problem and this is just one suggestion.

Have two CFs:

An authoritative select one value CF, call it “Customer List”, that has your
data and is mostly/fully hidden from the users. A second select one value
CF, call it “Customer”, that will get populated via some jQuery ajax calls.
This second CF should be void of values. The ajax will put them there when
the time comes.

Then create a REST-y codepoint (/Helpers/GetCustomers or something
similar) to serve the jQuery ajax calls and return the customers from
“Customer List”. The jQuery can then populate the “Customer” CF according to
your desired query.

There are some more details that I’m omitting. If you go down this road I
could elaborate more. :slight_smile: