| Page 1 of 1 | [ 6 posts ] |
|
Hey guys,
I'm trying to empty a text box with AutoComplete plugged in. I want to empty the text box after the user has made an auto complete selection. I thought doing this would work: var testText = Y.one('#test-text').plug(Y.Plugin.AutoComplete); testText.ac.on('select', function(e) { testText.set('value', ''); }); However, the text box is not being cleared, and no error is being thrown. I have a complete JSFiddle example at : http://jsfiddle.net/bdicasa/XkExx/2/ If anyone has any ideas on how to accomplish this, I would appreciate the help. Thanks, Brian |
|
I'm currently working around this by setting a timeout in the select event and then clearing the textbox in the timeout. However it doesn't seem like the cleanest solution to the problem.
|
|
It works fine for me,
after keypress i get suggested list, then i choose something and text-box value is replaced with what i choosed, what is your desired action? |
Alberto SantiniYUI Contributor
|
Hello bdicasa.
You need to use after: http://jsfiddle.net/XkExx/3/ Anyway I second MaurycyG's question. It seems to me quite useless the autocomplete if you clear the selection. Maybe I didn't understood your issue. Regards, IceBox |
|
Thanks for the help guys, that is a much better solution.
The reason I want to clear the text box after selection is that I'm appending the selected item to my GUI and want to allow the user to start typing a different item after selection. Probably not the most common use case, but it is turning out to be pretty slick. |
Alberto SantiniYUI Contributor
|
Hello bdicasa.
If you need multiple selection you may use delimeters. See the example: http://yuilibrary.com/yui/docs/autocomp ... gging.html Then you may add a sort of undo, just in case the user adds the wrong selection, and, when the user confirms the selections, eventually add the selected text to the gui. My two cents, IceBox |
| Page 1 of 1 | [ 6 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group