[rt-devel] dynamic search of custom field
mzagrabe at d.umn.edu
Thu May 14 12:20:59 EDT 2015
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
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
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 event;
I would avoid reloading the page.
> 2) 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. :)
More information about the rt-devel