To make a field dynamically read only, use the CodeCharge Component Attributes feature. Here are the steps:
Edit the form html and where the static text readonly will appear (assuming you want to this field to be always readonly) you will instead put this {RT_ID:readonly} Where RT_ID will be the name of the field as defined in code charge (Name attribute in field property)
In the before show event of the field, include these lines
if ($RT_TABLE->EditMode)
{
$Component->Attributes->SetValue('readonly', 'readonly');
}
Again where $RT_TABLE is the form name