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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:26:37+00:00 2026-05-19T10:26:37+00:00

I have two questions. I have a select tag in a rails 3 application

  • 0

I have two questions.

I have a select tag in a rails 3 application that looks like this:

 <%= select(@adverse_event_template_settings, 
    "display_arms", 
    options_for_select([["Yes", true], ["No", false]]), 
    { :selected => :display_arms },  
    :onchange => remote_function(:update => "display_arms", 
          :method => "put", 
          :with => "'display_arms=' + value", 
          :url => { :controller => :adverse_event_template_settings, 
               :action => :update, :id => @aets.id})) %>

This does what I want it to do- that is, call a controller action when the select box value changes.

Even though this works, I want to know 1) Is this valid in rails 3? I know it is obtrusive javascript, but remote_function working in rails 3 seems weird to me – is something wrong here?

and if the above is NOT valid, I really really really would like to know 2) how can I accomplish this same action (i.e. call the same action in the same controller) unobtrusively? Is there a way to do this simply and cleanly in rails 3? I desperately need coding help with this part.

Thank you so much!
Let me know if you need more details.

  • 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-19T10:26:38+00:00Added an answer on May 19, 2026 at 10:26 am

    (I assume you are using jQuery).

    I would put the javascript part in a .js file and manage the onchange event with jQuery.

    <%= select(@adverse_event_template_settings, 
        "display_arms", 
        options_for_select([["Yes", true], ["No", false]]), 
        { :selected => :display_arms }) %>
    

    and in the js file:

      $(document).ready(function() {
    
        $('#display_arms').change(function(){
          $.ajax({url: 'YOUR URL',
            data: 'display_arms=' + value,
            success: function(data){
              $('#display_arms').html(data);
              }
          })
        });
      });
    

    (I haven’t had time to test this but you get the idea)

    To be honest, I’m not sure there’s a way to do this kind of thing unobtrusively (or I’m interested!).

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

Sidebar

Related Questions

I have two questions: (1) I learned somewhere that -O3 is not recommended with
I actually have two questions regarding exception/error handling in the iPhone app that I
Hi I have two questions about MySQL and QUERIES. First of all i've like
Please note I am a beginner to this. I have two questions: 1) How
I have two questions regarding my script and searching. I have this script: $searchTerms
I have two tables that are related, which, for the purpose of this question,
Greetings, I have two questions regarding a DataTable.Select(): 1) How to escape potential apostrophes
I have two questions: 1) How can I make an array which points to
I have two questions. Do realloc() and memcpy() copy the entries in an array
I have two questions: 1) I have a few global variables for my website

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.