Load Javascript Conditionally Based on Form Value
You applied this code for all forms on your site, but only webform has $form['submitted'] element. To fix this issue you may use next code snippet

&lt;?php
/**
 * Implements hook_form_alter().
 */
 function module_name_form_alter(&amp;$form, $form_state, $form_id) {
   if (!empty($form['submitted'])) {
     if ($form['submitted']['formtype']['#default_value'] == 'type1'){
       drupal_add_js($js_path . 'type1.js');
     }
     else if ($form['submitted']['formtype']['#default_value'] == 'type2'){
       drupal_add_js($js_path . 'type2.js');
     }
  }
}
?&gt;