[rt-users] FW: FW: [rt-devel] dynamic search of custom field

mlind at sosml.net mlind at sosml.net
Thu May 14 16:02:05 EDT 2015

Ok, I looked into the autocompletion (i.e. 'select one with autocompletion')
.. lol .. works great; just didn't know it existed or how to search for it

It would be nice to see the entire list in case a user did not know what to
search for, but this solution is totally usable and clean and simple.

Thanks Matt.

-----Original Message-----
From: rt-users [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf
Of mlind at sosml.net
Sent: Thursday, May 14, 2015 12:03 PM
To: rt-users at lists.bestpractical.com
Subject: [rt-users] FW: [rt-devel] 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

-----Original Message-----

Hi Mike,

On Wed, May 13, 2015 at 12:15 PM,  <mlind at sosml.net> wrote:
> 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 
> customers.

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 
> '%<text field
> content>%'.

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
> and

I would avoid reloading the page.

> 2)      pass the text box content (value) to the query in
> RT::CustomFieldValues::Customers.

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. :)


More information about the rt-users mailing list