I found a solution to this. I had to add a jQuery .on() handler for focus. 
Is this the best way to handle this?
I guess this isn't a web2py problem, it's the nature of 
ajax/javascript/jquery I assume.  Any way for web2py to magically fix this 
kind of thing?

$(document).ready(function()
{     
    $(document).on("focus",'#autome',function(e) {
        if ( !$(this).data("autocomplete") ) { // If the autocomplete 
wasn't called yet:
               $('#autome').autocomplete({
                     source: function(request, response) {
                                            $.ajax({  url: 
"/autocomplete/default/myautocomplete.json",
                                                      data: request,
                                                      dataType: "json",
                                                      type: "POST",
                                                      success: 
function(data){ response(data.source)}  
                                                      })}});
                    }
    });
  
    $('#autome').autocomplete({
         source: function(request, response) {
                                $.ajax({  url: 
"/autocomplete/default/myautocomplete.json",
                                          data: request,
                                          dataType: "json",
                                          type: "POST",
                                          success: function(data){ 
response(data.source)}  
                                          })}});
    
});

On Monday, May 14, 2012 3:19:05 PM UTC-7, Larry Weinberg wrote:
>
> OK, here is a minimal sample app that demonstrates the problem.  I'm 
> pretty new to web2py so maybe I'm not using the system as I should be. 
>  Thank you for taking a look!

Reply via email to