Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5950695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:25:49+00:00 2026-05-22T17:25:49+00:00

Im trying to autofill a text filed using jquery plugin Autocomplete but im running

  • 0

Im trying to autofill a text filed using jquery plugin Autocomplete but im running in to a couple of problems, no list is genrated in the view and i get an error in firbug saying:

500 Internal Server Error, <h1>Template is missing</h1>
<p>Missing template messages/query with {:handlers=&gt;[:erb, :builder, :rjs, :rhtml, :rxml], :locale=&gt;[:en, :en], :formats=&gt;[:json, :js, &quot;*/*&quot;]} in view paths &quot;/Users/aldeirm2/Desktop/CMS2/app/views&quot;</p>. 

im guessing it has to do with the way im trying to return the json object?

Here is javascript code:

$(function() {
    var cache = {},
        lastXhr;
    $( "#username" ).autocomplete({
        minLength: 1,
        source: function( request, response ) {
            var term = request.term;
            if ( term in cache ) {
                response( cache[ term ] );
                return;
            }

            lastXhr = $.getJSON( "/usernames", request, function( data, status, xhr ) {
                cache[ term ] = data;
                if ( xhr === lastXhr ) {
                    response( data );
                }
            });
        }
    });
});

HTML code:

<label for="username">To:</label>  <input id="username" /><br />

search method in controller (routed to used “/search”):

  def query
    @users = User.auto_fill(params[:term])

    logger.debug "This is the USERS" + @users.first.username
    return @users.collect{|x| {:label => x.name, :id => x.id}}.to_json
  end

auto_fill method in model:

def self.auto_fill(search)
    query = "%#{search}%"
    where("username like ?", query)
  end

any help would be great thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:25:50+00:00Added an answer on May 22, 2026 at 5:25 pm

    i think because you are not rendering anything, rails is trying to find a query template to render. try:

    render :json => @users.collect{|x| {:label => x.name, :id => x.id}}
    

    or something along those lines

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I am trying to implement a dynamic search jquery and php, but I am
Trying to deploy application using ClickOnce to a webserver running sharepoint. I can publish
Trying to get jquery AutoComplete to return and populate it's dropdown. The input and
i am trying to implement autocomplete and autofill on a form. To simplify i
Trying to execute a Powershell cmdlet from a MVC 3 Controller using impersonation but
I have a situation where we are trying to autofill some form data on
Trying to get Thin working with Bundle on Windows, I know, major PITA but
I am trying to use a jquery getJSON get information for my table from
Trying to write a windows speech recognition macro. Written using XML and scripting language

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.