# Contingent selects - AJAX style

**URL:** <https://www.ruby-forum.com/t/contingent-selects-ajax-style/168821>\
**Category:** Rails\
**Created:** [May 26, 2009, 12:36pm UTC](https://www.ruby-forum.com/t/contingent-selects-ajax-style/168821 "2009-05-26T12:36:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JannaB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@JannaB](https://www.ruby-forum.com/u/JannaB)\
**Post date:** [May 26, 2009, 12:36pm UTC](https://www.ruby-forum.com/t/contingent-selects-ajax-style/168821/1 "2009-05-26T12:36:38Z")

</div>

If I have an html.erb file, wherein one select box’s selections  
displayed are contingent upon the value chosen in another select box  
(for example, if I have a state select box, contingent on the country  
showm in the country select box, so that if I have United States  
chosen as the country, and I switch to Canada, only the 12 provinces  
of Canada should now be available in the state select box) how can I  
accomodate that in an AJAX-manner? Below is the html.erb code I am  
trying to get this into (note I am using the Carmen plugin) Thanks,  
Janna B.

\<%= f.label :state %\>  
 \<%= f.state\_select :state %\>

\<%= f.label :country %\>  
 \<%= f.country\_select :country, 'US' %\>
