Get the value of a form element returned from an ajax callback function
I too not sure why the name attribute is not adding to the field. but you can bring by explicitly defining the name in the field.

 $form['form']['template2_field1'] = array(
      '#title' =&gt; t('GSIS No.'),
      '#type' =&gt; 'textfield',
      '#name' =&gt; 'template2_field1',    
      '#description' =&gt; "Government Service Insurance System number.",   
      '#attributes' =&gt; array(
          'id' =&gt; $template . '_field1' ,
      ),
  );