How would I clear values in ajax loaded select options? http://pastebin.com/TX2UiJGZ

I have 3 select drop-downs, selecting a value in the first populates the second using ajax, selecting the second populates the third. However when I change the value of the first select it doesn't reset the second (If I already chose the first and the second drop down initially).

Method


Choose an option from the first 
This populates the second select with options A, B and C
If I change the first one it won't reset the value if that value existed on the first option
So if our first option called A, B and C and we change the first drop-down to something else but it calls C, D and E; if C was selected in the second drop-down it doesn't reset since it existed in both ajax calls, this then doesn't load in the third select unless you select a different option in the second select.


Basically what I need is to reset the second and third select whenever the first changes.
SOLVED

/**
 * The ajax call to return data for the printer model select.
 * @return array             An array of settings.
 */
function first_ajax_callback(&amp;$form, &amp;$form_state) {
  // Reset conditional select values.
  $form['field_printer_model_value']['#value'] = array('All' =&gt; 'Select Printer Model');
  $form['field_printer_type_tid']['#value'] = array('All' =&gt; 'Select Device Type');

  // $commands = array();
  $commands[] = ajax_command_replace("#second_dropdown", drupal_render($form['field_printer_type_tid']));
  $commands[] = ajax_command_replace("#third_dropdown", drupal_render($form['field_printer_model_value']));

  return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);
}


In the above call I set the #value of the selects I want to reset. These lines properly reset two later dependent selects:

$form['field_printer_model_value']['#value'] = array('All' =&gt; 'Select Printer Model');
$form['field_printer_type_tid']['#value'] = array('All' =&gt; 'Select Device Type');