recognizing a keypress in a text field

Hi there. Has anyone ever had to do anything like this before?

I haven an input text field on my form with display type set to “text_field” and the valuelist is set to a dummy valuelist and my code populates that valuelist at the “onLoad” event based on an SQL query (i.e. select city from table_abc).

Everything works… when I start typing “L” for example in the input - the drop down shows me everything starting with “L” (e.g ’ Los Angeles, Las Vegas"). Fine… but I really want the dropdown to show me all cities containing what the user types ( e.g. buffaLo - as buffalo has an ‘l’ in it.)

If I could recognize some sort of event upon the keypress of the letter “l” , then I can easily run code to dynamically update my valuelist behind the text field to "select city from table_abc where city like ‘%<input_value_here>%’ which I think would work.
However I dont think servoy recognizes keypresses in a text field - Does it?>

Or is there another way to do this?

Kevin

Yes, use a valuelist by global method and set display type to typeahead.
Read the Servoy documentation regarding this topic.

Hi Lambert.
Thanks for the reply. I did end up getting it working with your help however I didn’t need to change the display type to “type_ahead”. Leaving it as “TEXT_FIELD” seemed to work fine. Not sure why.

I actually am having trouble finding the proper servoy documentation when dealing with issues like this. I’ve been to the Wiki pages but Im finding it generally helps with understanding syntax and what specific properties mean but I haven’t found it to be very usefull when looking for coding examples like the situation I was in with this problem. Maybe Im just not looking in the right spots I suppose. Ill have another peek.

Kevin