form does not validate function formexample_nameform(){

$form['user_name'] = array(
'#title' =&gt; t('your name'),
'#type' =&gt; 'textfield',
'#description' =&gt; t('Please enter your name.'),
);

$form['submit'] = array(
'#type' =&gt; 'submit',
'#value' =&gt; t('Submit'),
);

return $form;
}


if i add this:

'#name' =&gt; 'new name attribute',


it looks like this:

function formexample_nameform(){

$form['user_name'] = array(
'#title' =&gt; t('your name'),
'#name' =&gt; 'new name attribute',
'#type' =&gt; 'textfield',
'#description' =&gt; t('Please enter your name.'),
);

$form['submit'] = array(
'#type' =&gt; 'submit',
'#value' =&gt; t('Submit'),
);

return $form;
}


and it does not validate any more, it always let the inputs pass through.

my validate function:

function formexample_nameform_validate($form, &amp;$form_state){
if ($form_state['values']['user_name'] == 'King Kong') {
    form_set_error('user_name',
    t('King Kong is not allowed')
    );
}
}


question: what has the name attribute with validation to do?!
As per the FAPI the element textfield has no name attribute 

Available Properties are 

#access, #after_build, #ajax, #attributes, #autocomplete_path (default: FALSE), 
#default_value, #description, #disabled, #element_validate, #field_prefix, #field_suffix,
 #maxlength (default: 128), #parents, #post_render, #prefix, #pre_render, #process, #required,
 #size (default: 60), #states, #suffix, #text_format, #theme, #theme_wrappers, #title, 
#title_display, #tree, #type, #weight


I am not sure about the reason that the form is not validating, Excited to know the reason.