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 8351489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:38:43+00:00 2026-06-09T08:38:43+00:00

I have a form that a user can fill out that maps to an

  • 0

I have a form that a user can fill out that maps to an object in Rails.

One of the fields in the form auto-completes to instances of the object that have already been created.

I am trying to make it so that if an autocomplete option is selected on that one field, it will fill out the entire form based on that instance’s data.

I am assuming that the best way for this to be done is through an ajax call once the autocomplete is selected which grabs all the data and re-renders the form? That seems like it will create an undesirable delay between when the field is auto-completed and the form is auto-filled.

Is it then possible to have all the necessary data in the auto-complete data and auto-fill the form immediately?

  • 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-06-09T08:38:46+00:00Added an answer on June 9, 2026 at 8:38 am

    If you want instant access to your data, you need to preload it. Many ways to go about doing so. But considering you’re using AJAX autocomplete (assumption on my part), it would seem that you’ve already decided to live with that tiny bit of latency as the AJAX request roundtrips to the server. Given that, once the auto-complete field value is selected by the user, just load the corresponding data via AJAX at that moment. If the delay is too long for your tastes, consider a “spinner” graphic. This is such a common paradigm on the ‘Net these days, nobody will think twice if it takes < .5 second.

    As for the form being filled – at some point you’ll need to iterate over the object or the form fields and populate them with their corresponding values from the object. Using naming conventions here can help you, consider for example having your form’s inputs have class names that correspond to instance variable names in your object, such as:

    var instance = {
       name:'chapmand',
       beard:'brown',
       reputation:26
    }
    

    Then, your form might have fields like:

    <form id="my-form" ...>
        <input class="name" type="text"></input>
        <input class="beard" type="text"></input>
        <input class="reputation" type="text"></input>
        ...
    </form>
    

    Finally, once you’ve matched an instance of your object to what the user has entered, do:

    $('#my-form input.data').each(function(){
        $(this).val(instance[$(this).attr('class')]);
    });
    

    Contrived example of course and many ways to go about it, but that might help you get started.

    Cheers

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

Sidebar

Related Questions

I have about 20 text fields on a form that a user can fill
I want to create a custom form that a user can fill out for
I have a form that a user would fill out while creating a ticket
I have a form that users can fill out, and the data will be
I have a web form that users can fill out and that content fills
I have a zend form that lets the user fill out attributes of an
i have a form that has a multiple select drop down. a user can
I have a form on a page that a user can use to create
I have a form where a user can enter the number of students that
So I have a form that the user fills out, when submitted an new

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.