javascript select input previous selection
<p>I don't have much experience with javascript so I' not sure if/how this can be done. So I have a number of select components with a couple of options. One of these options for all of the components is "All". </p>

<p>Now I need to make sure that no more than one component has "All" selected. I'm using some input fields and making some validations to make sure this condition stands. However I can't see how I can do the following. When a user selects "All" from a field, and this is not allowed because there is already an "All" on the page, <strong>put the previous selection</strong> in it's place.</p>

<p>So far what I have is (component being the current select component):</p>

<pre><code>selectedName = component.options[component.selectedIndex].innerHTML;
if (selectedName == 'All') {
  if (emptyAllSpace() == 1) {
    //here I do all the mumbo jumbo needed and assign to the hidden field the name of 
    //the component
  } 
  else {
    //Here is where I should put back the old selection value. 
  }
 }
</code></pre>

<p>Now the else branch is where I need to figure something out. So how can I / how difficult would it be to get <strong>the selected option before the currently selected one</strong>. </p>

<p>I'm also interested how difficult it would be because I could also go another route and just put as selected the first option that is not 'All' but I would rather avoid this if it's no too time consuming.</p>

<p>Regards,
Bogdan</p>
