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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:17:25+00:00 2026-06-02T02:17:25+00:00

I am using Rails 2.3 and I don’t know how to retrieve the value

  • 0

I am using Rails 2.3 and I don’t know how to retrieve the value of a text_field of a form in order to handle it in the rjs file. I searched on the Internet all day and I didn’t find a solution.

Here is my code to be more specific :

In my form.erb file :

<%= observe_field 'issue_'+@issue.id.to_s+'_estimated_hours',
  :url=>{:action => 'check_estimated_hours_field'},
  :with => "'number=' + escape(value) + 
        '&fields_estimated_ids=#{@fields_estimated_ids}'" 
%>

Controller :

def check_estimated_hours_field
    @fields_estimated_ids = params[:fields_estimated_ids]
end

check_estimated_hours_field.rjs :

for @field_id in @fields_estimated_ids
     # here I want to add all the values of fields and retrieve the result in a ruby variable 
end

How can I manage to solve the problem I encounter in the comment in check_estimated_hours_field.rjs ?

  • 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-02T02:17:27+00:00Added an answer on June 2, 2026 at 2:17 am

    After several tests and research, it is apparently impossible to recover the value of a form field with RJS.
    The solution I found is to create a string containing all fields values ​​in the observe_field and parse this string to the RJS to retrieve the values ​​like this:

    In my form.erb file :

    <% = observe_field 'issue_' + @issue.id.to_s +'_estimated_hours'
      : url => {: action => 'check_estimated_hours_field'},
      : with => "'number =' + escape (value) +
        '& fields_estimated_values ​​=' + $ ('my_form'). select ('[class ~ = estimated_hours]'). collect (function (n) {
           return n.value + '_';
        }) + "
    %>
    

    In the controller:

    def check_estimated_hours_field
      estimated_hours_values ​​= params [:estimated_hours_values​​].split('_')
      @total_estimated_hours = 0
      estimated_hours_values.each {| value |
        @total_estimated_hours += hours.to_f
      }
    end
    

    In this way I can add all the values ​​and retrieve them in the variable @total_estimated_hours

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

Sidebar

Related Questions

I'm using Rails with Resque. I know the command of redis-cli is: expire key
I'm using Rails 3, ActiveAdmin and Kaminari. I have this on the documents.rb file
I'm using rails to build a website. I have a yaml file contails some
I'm using Rails 3 with assets pipeline enabled. And I know images such as
Using Rails 3.0.7. I have a simple form which shows all records from one
Using Rails 3.0.3 in combination with gems like devise I don't get any flash
Using Rails 3.0.3 in combination with gems like devise I don't get any flash
Am pretty new to ROR. Need help in Rails form validation. Am using rails
My question it's very simple, but I don't find a solution. I'm using: Rails
I am using rails 3 to create a site with a login form. When

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.