I wanted to add an onclick function to a cck field to fire off a javascript, I tried to use $form[field][#atributes] as usual in hook_form_alter, but for some reason this is not working. the element type is optionwidget_onoff.