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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:09:03+00:00 2026-06-07T10:09:03+00:00

i have a form with multiple selects from other tables in my database. i

  • 0

i have a form with multiple selects from other tables in my database.

i hava a relationship between vestigingen (locations) and organisaties (organisations) i would like to hide the option for that specific organisation untill it is selected in the dropdown.
so when it is selected i would like to choose which location. i would like to hide the location when no organisation is selected

screenshot:
enter image description here

i hope you understand what i mean.

thanks

EDIT: this is my _form.html.erb

<%= form_for(@contracten) do |f| %>
  <% if @contracten.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@contracten.errors.count, "error") %> prohibited this contracten from being saved:</h2>

      <ul>
      <% @contracten.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :naam %><br />
    <%= f.text_field :naam %>
  </div>
  <div class="field">
    <%= f.label :omschrijving %><br />
    <%= f.text_area :omschrijving %>
  </div>
  <div class="field">
    <%= f.label :organisatie %><br />
    <%= f.select :organisatieid, options_for_select(@organisaties.map{ |f| [f.naam, f.id] }), :include_blank => true %>
  </div>
  <div class="field">
    <%= f.label :vestiging %><br />
    <%= f.select :vestigingid, options_for_select(@vestigingens.map{ |f| [f.naam, f.id] }), :include_blank => true %>
  </div>
  <div class="field">
    <%= f.label :Beheerder %><br />
    <%= f.select :persoonid, options_for_select(@personen.map{ |f| [f.naam, f.id] }), :include_blank => true %>
  </div>
  <div class="field">
    <%= f.label :contractsoort %><br />
    <%= f.select :contractsoortid, options_for_select(@contractsoorten.map{ |f| [f.naam, f.id] }), :include_blank => true %>
  </div>
  <div class="field">
    <%= f.label :datumingang %><br />
    <%= f.datetime_select :datumingang %>
  </div>
  <div class="field">
    <%= f.label :datumeinde %><br />
    <%= f.date_select :datumeinde %>
  </div>
  <div class="field">
    <%= f.label :contractduur %><br />
    <%= f.number_field :contractduur, :placeholder => 'in jaren' %>
  </div>
  <div class="field">
    <%= f.label :opzegtermijn %><br />
    <%= f.number_field :opzegtermijn, :placeholder => 'In Maanden' %>
  </div>
  <div class="field">
    <%= f.label :betalingsperiode_eenheid_id %><br />
    <%= f.number_field :betalingsperiodeeenheidid, :disabled => 'true' %>
  </div>
  <div class="field">
    <%= f.label :betalingstermijn %><br />
    <%= f.number_field :betalingstermijn %>
  </div>
  <br>
  <div class="actions">
    <%= f.submit "Toevoegen", :class => 'button3' %>
  </div>
<% end %>
<br>
  • 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-07T10:09:06+00:00Added an answer on June 7, 2026 at 10:09 am

    Take a look at the first example on here

    http://api.jquery.com/val/

    Should give you an indication of how to do this with JQuery

    Basically you need to assign an onchange event to your select and then show your secondary select when val is not null or equals a certain option.

    If you post your code a more specific answer could be provided

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

Sidebar

Related Questions

i have a form that has a multiple select drop down. a user can
I have form with multiple input type=radio with text next to them. I want
I have a Form with multiple different controls like ComboBox , TextBox and CheckBox
I have a form with multiple dropdowns consisting of multiple values. I'm trying to
I have a form with multiple textboxes which are created dynamically, now all these
I have inserted this form with multiple checkbox items which collects some values, What
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have a form that enables a user to update multiple alert rules records
I have a report that is basically a form with multiple empty fields and
I have a form made in JSP, here I have multiple buttons - Approve,

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.