Invoking AJAX on a form messes up my form_alter function I am altering the "Add node" form for one of my types so that I can set the title and disable the text box. The (shortened) code looks like this:

function mytheme_form_node_form_alter(&amp;$form)
{
    $form['title']['#default_value'] = 'Some value';
    $form['title']['#disabled'] = true;
}


On the node form, I have a field with "Unlimited values" where a user can click "Add another item" to add another row to the items grid on the form.

The problem: When I click this button and the AJAX request happens, it adds the row to the table as usual. But when I save the form, Drupal thinks the Title is empty, and throws a validation error back. The title is still set and greyed out after the AJAX request happens (like it should be), but it seems to "unset" itself somehow behind the scenes when the AJAX request happens, because when the form gets saved, the title gets cleared and the validation error occurs.

I hope I made that clear... so does anyone know why the AJAX related to unlimited fields might interfere with theme_form_X_form_alter?
function mytheme_form_node_form_alter(&amp;$form){
    $form['title']['#default_value'] = 'Some value';
    $form['title']['#value'] = $form['title']['#default_value'];
    $form['title']['#disabled'] = true;
}


This should solve the problem. 
In HTML, disabled form elements' value will not be sent back to the server so server gets nothing back, which result in a form error if the value is required. Storing value in #value overrides any browser input which is a must (for security purposes) when you disable a form element and expect its value back.