![]() |
ui.combobox: Enter key causing problems
Hello, everyone.
I have a form that is used to filter tasks (the page default is "everything"; you can type in either "Application" or "Customer" fields and the autosuggest/autofill starts to populate the respective field.) The submit button prevents the default form submit and does the submit via AJaX. So far, this is working quite nicely, IF the user clicks on or highlights a suggestion. However, should the user hit the enter key without highlighting one of the suggestions, the selections disappear and the field is left with just the letters that the user has typed, thus far, and submits the form (bypassing the preventDefault() command), and the next thing I see is the whole page is replaced by just the form. If I could figure it out, I suppose I could put an event handler that will ignore the Enter key; but this is the first time I've used ui.combobox, and I'm not sure what to do. Any thoughts? Thank you, |
sounds like you've done the classic mistake of binding your desired ajax functions to the submit button itself.
Instead of doing that, bind it the forms submit event instead. http://api.jquery.com/submit/ Code:
$("#element").submit(function(e){ |
As soon as my dev system boots up, I'll check the code. I don't think I've got it bound to the submit button.. actually, I don't think there IS a submit button, I think it's just an input type="button". But I'll report back what I've got.
UPDATE: As I suspected.. three select elements and an input type="button", no submit. Could the combobox be causing this? Thanks, |
Well, I don't know exactly what is causing this, but I finally figured a solution.
In the form tag, I put onsubmit="return false;". Now it doesn't default submit and will still AJaX submit. |
| All times are GMT +1. The time now is 08:07 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.