Answers.Body: <p>I would write a custom fieldtype (<a href="http://buildwithcraft.com/docs/plugins/field-types" rel="nofollow">http://buildwithcraft.com/docs/plugins/field-types</a>) with two selects. Makes sense to make it as one field if they are dependent of eachother.</p>
  
  <p>Just store the field as json (AttributeType::Mixed) and inject your own javascript in the fields <code>getFieldHtml()</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T12:25:49.563Z
Answers.LastActivityDate: 2015-07-23T12:25:49.563Z
Answers.UserDisplayName: fuling
Answers.Body: <p>Instead of building a custom fieldtype, you could just connect two standard dropdown menus with some custom JavaScript. The easiest way to do that would probably be via the <a href="https://github.com/lindseydiloreto/craft-cpjs" rel="nofollow">Control Panel JS</a> plugin.</p>
  
  <p>Fortunately, the control panel already uses jQuery, so you wouldn't need much JS to tie the two fields together.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-14T05:49:51.233Z
Answers.LastActivityDate: 2016-03-14T05:49:51.233Z
Answers.UserDisplayName: Lindsey D
Body: <p>I'm looking to change a select fields options with the onChange event from another select fields chosen option. Obviously this can be done with js on the frontend as per <a href="https://craftcms.stackexchange.com/questions/4779/tie-two-select-fields-together-based-on-category-and-subcategory">this post</a> but has anyone done this for the control panel? I imagine it will need to be done via a fieldType plugin, but wondered if anything already exists for this type of functionality before I attempt to build something.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T10:04:42.303Z
Comments.Text: Do you already have a plugin and fieldType where you want to do this, or do you mean "this one built-in selectField is connected to this other built-in selectField?
Comments.UserDisplayName: fuling
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T12:16:53.543Z
Comments.Text: Could be either. If there is a way to connect select fields in craft already then great where can I find the documentation for it. If not then I would be looking at a plugin to do this.
Comments.UserDisplayName: Lettie
Tags: <field><fieldtypes><custom-fieldtype><custom-field>
Title: Populate or change the selection options in one field based on selected option in another field in the CP
ThreadText: # Populate or change the selection options in one field based on selected option in another field in the CP
  
  (Asked by: username_0 on 2015-07-23)
  
  I'm looking to change a select fields options with the onChange event from another select fields chosen option. Obviously this can be done with js on the frontend as per [this post](https://craftcms.stackexchange.com/questions/4779/tie-two-select-fields-together-based-on-category-and-subcategory) but has anyone done this for the control panel? I imagine it will need to be done via a fieldType plugin, but wondered if anything already exists for this type of functionality before I attempt to build something.
  
  **Tags:** field, fieldtypes, custom-fieldtype, custom-field
  
  > **Comments:**
  > **username_1**: Do you already have a plugin and fieldType where you want to do this, or do you mean "this one built-in selectField is connected to this other built-in selectField?  
  > **username_0**: Could be either. If there is a way to connect select fields in craft already then great where can I find the documentation for it. If not then I would be looking at a plugin to do this.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-07-23. Score: 2
  
  I would write a custom fieldtype (<http://buildwithcraft.com/docs/plugins/field-types>) with two selects. Makes sense to make it as one field if they are dependent of eachother.
  
  Just store the field as json (AttributeType::Mixed) and inject your own javascript in the fields `getFieldHtml()`
  
  
  ---
  
  ### Answer by username_2 on 2016-03-14. Score: 1
  
  Instead of building a custom fieldtype, you could just connect two standard dropdown menus with some custom JavaScript. The easiest way to do that would probably be via the [Control Panel JS](https://github.com/lindseydiloreto/craft-cpjs) plugin.
  
  Fortunately, the control panel already uses jQuery, so you wouldn't need much JS to tie the two fields together.
  
  
  ---
  
  