What am I doing wrong with accessing this array element? $form['cookie']['saved'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; 'How long?',
    '#required' =&gt; TRUE,
  );


But if I do:

  if ($form_state['values']['cookie']['saved'] == 'Dog the Bounty Hunter') {
    form_set_error('dog_error', t("That doesn't make any sense."));
  }


I get an error that the 'cookie' index doesn't exist.
Install the development module and do dpm($form, 'the form'); and dpm($form_state, 'my form state'); in your form alter function. I believe you'll see that $form_state is "flattened" to only the innermost values of your form array.

So, the saved array key exists, not [cookie][saved].

In general try to make use of this convention, or assumption by drupal. Usually your FAPI form has fieldset(s) as outer keys (not passed into $form_state at all, they only affect the appearence of the form) and input values as inner keys. So rename your 2nd key from saved to cookie_saved.

If you really (for some reason) want the ['cookie']['saved'] to be in $form_state just as-is -- perserving the hierarchy of information. You would want to set the #tree property of cookie in your FAPI array.

See these 2 resources of information:


Legacy drupal page talking about FAPI usage
current FAPI quickstart guide.


Both are relevant for background information how FAPI usage and how its evolved to meet our needs as developers. Search for #tree and #parents within the linked documentation pages.