I needed to show some preexisting data from a table and but needed to disable them to prevent user from editing them. So i disabled them
$form -> getElement(\"e
This worked like a charm for me. It prevents the element from being edited and will pass it through the post.
$this->username->setAttrib('readonly', 'true');