Custom validation for profile type? I used profile2 module and create some profile types,in one of them I have a custom field require custom validation .
I did use drupal validation with custom validation function .
Lets suppose  I have a field with name  'nationalcode' if it was form element just need this in my custom module hook_form_alter(&amp;$form,&amp;$form_state)

$form['field_nationalcode']['#validation'][] = 'my_custom_validation_function';


And determine my_custom_validation_function function with my custom validation 

function my_custom_validation_function(&amp;$form,&amp;$form_state) {
  if(!mycustomvalidation)
     form_set_error('field_nationalcode','my custom message');
        // I am not sure mayebe this one
     form_set_error('nationalcode','my custom message');
 }


But really what I should do in profile type cusotm validation?

I  set #validation  but How can i set form_set_error with profile type? .I means what i should  use in first parameter in form_set_error ?
I found The good solution for validate nested form elements
according to drupal 7 form_set_error api need to use 

form_set_error('myporifletypename][myfieldname', 'my error message');   


As example     

 form_set_error('user_info][field_nationalcode', 'Your National code not valid');