CRM 4.0 does not allow you to change the IsDirty property of a field or the crmForm. These properties are calculated.
The way CRM calculates this value is by checking the fields DataValue against the fields defaultValue.
It might be nessecary to set the form to Dirty from an IFRAME or another source. To do this you could change the default value of one of the fields on the form.
In my case I always use the 2nd control on the form (which is actually the first field in all crmForms).
crmForm.defaultValue = “something nobody will ever enter in the field”;
(In my case I put a GUID in there)
NOTE: The defaultValue property is NOT documented in the SDK so I’m pretty sure this code is unsupported!