Autosuggest the Textbox in Flex

After a very long time I got time to code something. I thought what to write, various technology which one to go with PHP, Coldfusion, flex, javascript. After thinking for a min, I started with Flex. What to create? Autosuggest TextBox!.

So I created a autosuggest textbox, I quickly thought what all I need

Textbox, Allow user input.
Listbox, To hold the list the matched list from the textbox.
Tweening, Which will give a feel of panel movement comig out of the textbox with matched value.

Algorithm
=========
1.Track keyUp event on the textbox which in turn filter the main array which is holding the entire values.
2.Apply regExp which will hold the format to look for.
eg. typing A, should give me all the values starting from the ‘A’ character.
3.test the regular expression against the main array by looping over each value.
4.If test successful then hold these value into the new array which in turn binded with the list box.
5.Animate the list box with resize event if filteredArray has more values into it from the step 4.

Notes
=====
We can supply the list to main array from database, or keep it hardcoded.

You are ready with your autosuggest box.

Click here to view the Working sample

Happy coding 🙂

Advertisements

5 Responses to Autosuggest the Textbox in Flex

  1. Eric says:

    Will you be posting the source to your autosuggest sample?

  2. Rohan Pinto says:

    u got my email address… please shoot me an email, I need to get in touch with you regarding some work on “flex”

    Rohan

  3. Hey Vijay,
    your sample is not working properly. The list which comes down is not focusable with arrow keys.You have to make the list tab-enabled and dispatch the event from a textbox to the list. But anyways great work.Keep it up

  4. Raghu says:

    Can u please post the source code for me.

  5. ravi says:

    can you pl send the code snippet for Auto Suggest Textbox in Flex

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: