title: How to combine two select fields in a form
body: <p>I'm trying to combine the values of two select fields in a form into a single variable before submitting the form.</p>
  
  <p>Here is  the just of my code:</p>
  
  <p>In new.html.erb (for RoR):</p>
  
  <pre><code>&lt;%= form_for :character, url: characters_path, method: :post do |f| %&gt;
    &lt;p&gt;
       &lt;%= f.label :alignment %&gt;&lt;br&gt;
       &lt;%= f.select :alignment_lr, options_for_select([" ","Chaotic","Neutral","Lawful"], disabled: " ", selected: " ") %&gt;
       &lt;%= f.select :alignment_ud, options_for_select([" ","Good","Neutral","Evil"], disabled: " ", selected: " ") %&gt;
    &lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>This generates the following html:</p>
  
  <pre><code>&lt;p&gt;
    &lt;label for="character_alignment"&gt;Alignment&lt;/label&gt;&lt;br&gt;
    &lt;select id="character_alignment_lr" name="character[alignment_lr]"&gt;
      &lt;option disabled="disabled" selected="selected" value=" "&gt; &lt;/option&gt;
      &lt;option value="Chaotic"&gt;Chaotic&lt;/option&gt;
      &lt;option value="Neutral"&gt;Neutral&lt;/option&gt;
      &lt;option value="Lawful"&gt;Lawful&lt;/option&gt;&lt;/select&gt;
    &lt;select id="character_alignment_ud" name="character[alignment_ud]"&gt;
      &lt;option disabled="disabled" selected="selected" value=" "&gt; &lt;/option&gt;
      &lt;option value="Good"&gt;Good&lt;/option&gt;
      &lt;option value="Neutral"&gt;Neutral&lt;/option&gt;
      &lt;option value="Evil"&gt;Evil&lt;/option&gt;&lt;/select&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>How can I combine the values selected for <code>:alignment_lr</code> and <code>:alignment_ud</code> to equal something like <code>alignment.value = alignment_lr.value + ' ' + alignment_ud.value</code>?</p>
  
  <p>I am open to using javascript or jquery in order to resolve this.</p>