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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:44:09+00:00 2026-05-11T00:44:09+00:00

I am trying to create a form in Rails 2.2.2 that populates a field

  • 0

I am trying to create a form in Rails 2.2.2 that populates a field based on a choice a user has made in an ‘auto_complete’ field. It looks as though the observe_field functionality is what I need to use but I’m stuck on how to update the value of an existing text field.

The sequence of events I am trying to model is follows:

1) Use types some characters into a auto_complete field, is given a list of options and selected the relevant option.

2) The option corresponds to an ActiveRecord model and I would like to populate another field in the same form (i.e. set a default) using information from the selected ActiveRecord.

Thanks for any guidance

David

  • 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. 2026-05-11T00:44:10+00:00Added an answer on May 11, 2026 at 12:44 am

    I initially started to just use the observe_field functionality to observe the auto_complete_text_field value and then update another value based on the users selection as shown below but I was unable to reference the innerHtml of the text field as required by the observed_field

    ‘blur’, :frequency => 0.50, :url => {:action => ‘update_defaults’}, :with => ”reference_number=’ + element.value’, :update => ‘form_text_field’ %>

    To resolve the issue I ended up removing the update parameter from the observe_field and using RJS to update to the form field from within the action method instead.

    The RJS is the method looks as follows:

     render :update do |page|     page['form_text_field'].value = @activity.units   end 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a form that based on the users input would determine
I'm trying to create a child form that helps the user to enter data
I'm trying to create a multi-level ajax form on my rails app that can
I'm trying to create a User model for my Ruby on Rails app that
I am trying to create form that contains another model in rails. I have
I'm trying to create a form that clients would complete via the web, so
Using C#, I'm trying to create a form with a dataGridView that shows the
I'm trying to create a C# form app that will allow me to use
I am trying to create a db that has a year attribute but I
New to rails 3 I would like to create a contact form that people

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.