Menu

#2 Autosuggest Textbox

Unstable (example)
open
5
2007-09-18
2005-11-23
jcmurphy
No

I am posting an Autosuggest Textbox. This is not done,
but I thought I'd post it now for feedback and
suggestions, as well as to help anyone implementing
something similar. It still as some issues. I'm not
sure it's really "Anthem-y", as it contains a ton of
javascript. There's probably a nicer way to write it.

To use the control, just drop it on a page. The
[Anthem.Method] OnKeyUp has hard coded values in it.
If you type "Ald" in the textbox you can see it in
action. The version I'm actually working on calls a db
proc which returns a ref cursor and builds a string.
If anyone needs that code let me know.

I plan to add support for the following:
1) allow up arrow and down arrow to move through the
dropdown

2)Fix the backspace to suggest

3)Add switches for autosuggest on/off, number of rows
in dd, etc.

It's tested in IE 6 and FF 1.0.7

I'd love to hear criticisms/suggestions

Discussion

  • jcmurphy

    jcmurphy - 2005-11-23

    Logged In: YES
    user_id=1367221

    I should also point out that much of the js came from an
    article on code project, which I didn't write.

    http://www.codeproject.com/aspnet/AJAXWasHere-Part3.asp

     
  • Nobody/Anonymous

    Logged In: NO

    Did you try researching this:

    http://richardxin.com/TestGoogleSuggest.aspx

     
  • jcmurphy

    jcmurphy - 2005-11-29

    Logged In: YES
    user_id=1367221

    I am uploading a new version of my AutoSuggest Textbox. It
    has several new features:
    1) Up arrow, down arrow and backspace now work correctly
    2) Textbox has attribute AutoSuggest (true/false)
    3) Textbox has attribute AllowEditing. If set false, will
    not allow user to key text that isn't in the suggest list
    4) Textbox has attribute ErrorLabelName. If set to the name
    of an Anthem.Label (like Label1), and AllowEditing = False,
    will set Label.text to an error message: "You must choose a
    value from the dropdown"

    Once again, the values are hardcoded in. Type "Ald" to see
    it in action. Type "Aldax" to see the AllowEditing
    behavior. I have included commented-out code demonstrating
    the use with a datareader.

    This is tested in IE 6, FF 1.0.7, and Safari 2.

     
  • jcmurphy

    jcmurphy - 2005-12-01

    Logged In: YES
    user_id=1367221

    2 more bug fixes. IE wasn't positioning the div correctly
    on reflow, and allowediting = false had a race condition
    that would allow invalid input

     
  • jcmurphy

    jcmurphy - 2005-12-03

    Logged In: YES
    user_id=1367221

    This patch fixes bug 1372311. For anyone using this
    control, I've found a possible gotcha using a database.
    Make sure you Dispose your DB connections to return them to
    the pool, as they will not be GCed quickly enough for long
    text entry.

     
  • jcmurphy

    jcmurphy - 2006-02-01

    Logged In: YES
    user_id=1367221

    I've uploaded a new version of my autosuggest textbox. It
    has the js in a separate file, and includes a test page. I
    have only tested it in VS2005 with .Net 2. Hopefully
    someone can test in 2003 as well.

    I now draw an iframe under the div to prevent IE displaying
    windowed controls through the div.

     
  • jcmurphy

    jcmurphy - 2006-02-27

    New version implements iupdatable

     
  • jcmurphy

    jcmurphy - 2006-02-27

    Logged In: YES
    user_id=1367221

    I've uploaded a new version. It implements Iupdatable. It
    also wipes out the text/div on the escape key, and handles
    ampersands in the suggested text correctly. I think the
    version I sent to the mailing list was the wrong one. I'm
    getting confused. Sorry.

     
  • Nobody/Anonymous

    Logged In: NO

    the zip file is corrupt can you post a new copy please.

    thanks in advance

     
  • seanmmcc

    seanmmcc - 2006-03-16

    Logged In: YES
    user_id=1478286

    i am still working in 1.1 it appears there is a few bugs.
    one i fixed the other i cant seem to figure out....

    line 135 the stream ref was incorrect needs to be:

    Stream stream = typeof
    (Anthem.AutoSuggestTextBox).Assembly.GetManifestResourceStre
    am("Anthem.TextBox.js");

    How do you perform this logic (line 231 in asp.net1.1?)
    this.Page.ClientScript.RegisterStartupScript(typeof
    (TextBox), newUid, acScript.ToString());

    thanks for your help.

    sean

     
  • Michael Cook

    Michael Cook - 2006-03-23

    Logged In: YES
    user_id=885182

    Yes, there is an issue with the v1 of the script. Try this:

    this.Page.RegisterStartupScript(newUid, acScript.ToString());

     
  • Nobody/Anonymous

    Logged In: NO

    HI

    I would Love to see the source code for this one. Can u pass
    it to my email id vik20000in@gmail.com

    Thanks

    Vikram

     
  • antares_dark

    antares_dark - 2006-04-27

    Logged In: YES
    user_id=1364646

    it only works in framework 2.0? would be nice see it
    implemented in the next release of Anthem or any instruction
    how to get it working with the actual version of Anthem,
    i've tryed, compiled and run, but the example page dont show
    correctly and not work fine.

    Thanks !

     
  • Michael Cook

    Michael Cook - 2006-04-27

    Logged In: YES
    user_id=885182

    I'm testing this in 1.1 and with the change I suggested
    below it seems to work just fine.

     
  • antares_dark

    antares_dark - 2006-04-28

    Logged In: YES
    user_id=1364646

    Yes i could make work the control with this modifications
    but i added an #if for the compiler
    like this:

    #if V2
    this.Page.ClientScript.RegisterStartupScript(typeof(TextBox),
    newUid, acScript.ToString());
    #else
    this.Page.RegisterStartupScript(newUid,acScript.ToString());
    #endif

    Those the same archive (class) works in both versions of .Net :)

    Also the line that injects the TextBox.js in VS 2003 must be
    changed like is explained below but it's really working?
    In my case the page NewAutoSuggest.aspx won't work if you
    don't add the
    <script language="javascript" type="text/javascript"
    src="TextBox.js"></script>

     
  • antares_dark

    antares_dark - 2006-04-28

    Logged In: YES
    user_id=1364646

    Sorry i pressed "Submit" earlier...

    i was saying..

    In my case the page NewAutoSuggest.aspx won't work if you
    don't add the
    <script language="javascript" type="text/javascript"
    src="TextBox.js"></script>

    In the header of the aspx page and copy the TextBox.js to
    the root of the site.

    Tks !

     
  • Andy Miller

    Andy Miller - 2006-05-08

    Logged In: YES
    user_id=1245761

    Would one of you post this in the new extensions folder of

    http://forums.anthemdotnet.com/forums/index.php

     
  • Nobody/Anonymous

    Logged In: NO

    a

     
  • Andy Miller

    Andy Miller - 2007-09-18
    • assigned_to: nobody --> psiegers
     

Log in to post a comment.