I want to set some of the form elements readonly. The problem is, that they are saved as type=container. So i'm not able to just set #attributes to readonly=readonly, like i've done at another element.

  • there is no type as controller see api.drupal.org/api/drupal/… – niksmac May 15 '14 at 8:46
  • I've edited it, i meant type=container, like i mentioned in the title. sorry. – drupalist May 15 '14 at 8:52
  • 1
    container Returns HTML to wrap child elements in a container. How can we make a div readonly ? – niksmac May 15 '14 at 8:53
  • What @NikhilM said...to make something read-only it has to be writable in the first place, which obviously a container isn't. Could you mean you want to recursively set all children of a particular container to readonly? – Clive May 15 '14 at 9:03
  • Thanks for the fast answers! In my case I'm showing all fields, that belongs to a user. The standard system fields mail, passwd and so on can be set readonly without any problem. But let's say I added the field "favorite animal". This field is shown as type 'container' when I look at the array with dsm(). :/ – drupalist May 15 '14 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.