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

  • Home
  • SEARCH
  • 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 6006767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:35:14+00:00 2026-05-23T01:35:14+00:00

My question is very similar to this one: Getting an error in jQuery when

  • 0

My question is very similar to this one: Getting an error in jQuery when I try to autosave a form field with an ajax call

But the only problem with me is that my situation is more complex. I have a form which has 2 sections. To each section the user can add rows while inputting their data. Each row has a text field and a select box. I need to update the database values of these text fields and select boxes as they change.

Since these all are added on the fly, their ids are different. Ideally I would like to use onchange for each textfield and select box and call required functions which will make ajax call to update respective values. But when I try calling a function onchange, nothing happens. I am wondering if this use is deprecated in Rails 3 in favour of unobtrusive js.
Here’s how my haml for the textfield looks:

= builder.text_field "regular_expenditure", :value => val, :title => builder.object.regular_expenditure > 0 ? "" : '0.00', :size => 7, :class => "defaultText", :onchange => "javascript:sendGivenupAmount('challenge_givenup_items_attributes_#{@given_up.rindex(given_up)}_regular_expenditure', '#{given_up.id}');"

In my js file:

function sendGivenupAmount(){
    alert('in function');
}

Am I doing something wrong? Is there any other way to do this?
Thanks in advance for any help

M

  • 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-23T01:35:15+00:00Added an answer on May 23, 2026 at 1:35 am

    Thanks for the support. I think I found a solution. I just made some changes to the view and accessed the elements through DOM in jquery. I could manage getting around it.

    Thanks,
    M

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

Sidebar

Related Questions

Liu Chang asked a very similar question to this one here, Linux equivalent of
this oughta be an easy one. My question is very similar to this one
I have a question that is very similar to this one: Setting focus to
My question is similar to this one but I'm having some problems with the
My question is very similar to this one Not drawing outside bounds when clipToBounds=NO
My question is very similar to this one: What is the optimal way to
My question is very similar this but I guess I need to take it
There is a question very similar to this but I wanted to ask it
My question is very similar to this one . I really thought that <input
Very similar to this question , except for Java. What is the recommended way

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.