Textbox onDataChange not Detecting character changes

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

Textbox onDataChange not Detecting character changes

Postby ryan1680098789 » Wed Mar 29, 2023 4:42 pm

I'm working on developing a form with a textbox that has a custom drop down to display records. As the user types in the textbox, the drop down will be auto searching the records in the drop down with the string the user is typing. The on data change for textbox's only detected a data change on focus loss or if the user presses enter. I know that the typeahead component has this functionality of displaying a value list, and as the user types it will sort/search the list for every character change that occurs. Normally I would use a typeahead but because I need a custom drop down I cannot use it. So I am wondering if there is a way to detect character changes on a textbox?
ryan1680098789
 
Posts: 13
Joined: Wed Mar 29, 2023 4:06 pm

Re: Textbox onDataChange not Detecting character changes

Postby steve1376656734 » Thu Mar 30, 2023 3:57 pm

Why not use a typeahead with a custom valuelist that has a global method. That way, whatever function you are currently using to construct the dropdown items can be used to return the custom valuelist items. Takes away all the hassle of having to create your own dropdown:
Custom_valuelist_global_method.png
Custom_valuelist_global_method.png (36.9 KiB) Viewed 2617 times

As the user types, the global method will be called with the currently typed value and you can return the filtered list accordingly.
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 339
Joined: Fri Aug 16, 2013 2:38 pm
Location: Ashford, UK

Re: Textbox onDataChange not Detecting character changes

Postby ryan1680098789 » Thu Mar 30, 2023 4:47 pm

I've tried a custom value list but the custom value list doesn't account for the fact that I need to add some extra components that are needed to be seen in the drop down (i.e. showing a few buttons in the drop down), hence the custom drop down.
ryan1680098789
 
Posts: 13
Joined: Wed Mar 29, 2023 4:06 pm

Re: Textbox onDataChange not Detecting character changes

Postby steve1376656734 » Thu Mar 30, 2023 4:53 pm

Then the only other thing I can suggest is to add a keylistener to the textbox and use that to capture individual keystroke changes and manipulate the dropdown from there.
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 339
Joined: Fri Aug 16, 2013 2:38 pm
Location: Ashford, UK

Re: Textbox onDataChange not Detecting character changes

Postby ryan1680098789 » Thu Mar 30, 2023 4:56 pm

That's a good idea, I forgot about that......Thank you for your suggestion!
ryan1680098789
 
Posts: 13
Joined: Wed Mar 29, 2023 4:06 pm


Return to Web Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron