json - Validating input with jQuery autocomplete plugin -
I am using the standard Autocomplete plugin.
I have my text, two text boxes on the item name and item ID. The idea is that I want to find the item by name to the user, but to actually submit it on the form, the wanted.
I am refunding JSO with an ASP.NET MVC action which is Autocomplete.
The user starts typing the name of the item, the autocomplete list appears and the Jason object is formatted to show the name of the item. Users can then click on a name from the list and item IDs will come in another text box (which will actually be the hidden field when everything is working). Then I can check that there is a value in this second textbox before submitting the form.
Everything works great in the above scenario but I have two big bugs in such a large number:
1) The user actually returns the result
function To click on the item for the list in the fire. Therefore, if an item is Apple , and the user simply writes Apple in the text box, the item ID is not populated.
2) You can select Apple from the user list, which populates the item ID, then the user changes his mind, and the text box and type oranges Again, if he does not actually click on the item in the list, the item ID does not change and now when the form is submitted the wrong item id is submitted. The only thing is that the user is not a valid selection, for example, it changes the text box to applesblahblahblah , item ID of apple still accumulates Although being a legitimate item was not liked.
I have seen an example that suggests that this can be solved by firing the search
event, but I have tried and this is
How does anyone know how to solve this problem?
My code is so far down, at the moment all this is pretty good ...
P>
$ ('# ItemSearch'). Autocomplete ("MyAction / FindItems", {dataType: 'json', pars: function (data) {var parseed = []; for (var i = 0; i
I would be grateful for any indication. Thanks
Edit: If better is standalone that handles Jason and forced verification, then I would be happy to hear the suggestion as it might be easier to try to work is .
There may be a better autocomplete, which requires the jQuery UI (too large library), but more flexible. There are so many events that you can use to apply verification.
Comments
Post a Comment