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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:19:33+00:00 2026-05-30T20:19:33+00:00

Currently I’m having a two drop down list one indicating the role and other

  • 0

Currently I’m having a two drop down list one indicating the role and other assigning to filed. My code is

<div class="field">
    <% f.label :role %>
    <%= f.select :role, options_for_select(%w(Investigator Manager Director)) %>
</div>
<div class="field">
    <h4>Assigning to</h4>
    <%= f.collection_select( :assigned_to, User.find_all_by_role("Manager"), :id, :email)  %>
</div>

I want the second drop down list to be appeared only when an investigator is selected in the first drop down list. Any suggestions on how I can achieve this

  • 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-30T20:19:35+00:00Added an answer on May 30, 2026 at 8:19 pm

    You are going to want to use jquery and javascript to accomplish this. Another great resource would be this railscast by ryan bates about the exact issue.

    What you basically want to do is have some javascript that is observing the current value of the :role drop down box. Normally you would do the check through a .bind (.on) to the change event of the drop down. Then you want to show/hide the :assigned_to box depending on that value. Since this appears to be a stack set of options, it should be a pretty simple bit of javascript.

    jQuery ->
      ($ 'select#assigned_to').hide()
      ($ 'select#role').change ->
        role = ($ 'select#role :selected').text()
        if role is 'Investigator'
          ($ 'select#assigned_to').show()
    

    Now obviously that was coffeescript and should be converted accordingly, but that should help you figure out what needs to be done.

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

Sidebar

Related Questions

Currently i'm having trouble using two functions in my -(void)viewDidLoad , both of these
currently i have a form, that generates a Drop-Down-Select from my category-entity: $builder ->add('category',
Currently I know of only two ways to cache data (I use PHP but
Currently, I have: <html> <div class=yes1><span><img src=img></span></div> </html> <script> var x = ='yes1' var
Currently my website (production server) already have a lot of code in it. And
Currently, working with RC0 Denali, having some issues I am attempting to review data
Currently, I have a log file of messages in one table in a MySQL
Currently I have in my code tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(addCompoundToLabel:)]; My code
Currently I have a simple setup where I maintain a list of bools corresponding
Currently, I have a custom list adapter that has some logic that hide/show a

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.