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(&$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
?