Mandatory Related Entities
Friday, January 25th, 2008In line with the previous post we had a situation with a related entity in an iFrame on the form.
Before the form is saved the first time the iFrame will not show up.
It should not be possible to use the “Save and Close” before the form has been saved for the first time to make sure the users are always confronted with the iFrame.
The “Save and Close” button will only be available if the iFrame is shown.
To do this we have to disable the close from the “Save and Close” commando if the form is saved for the first time.
if (crmForm.FormType==1)
{
if (event.Mode == 2)
{
alert ("You have to save the Form before the iFrame will show up");
event.returnValue = false;
crmForm.Save();
}
}
//crmForm.FormType == 1 means the form is new.
//event.Mode == 2 refers to the "Save and Close" button
Another possibility is to hide the “Save and Close” button if the form has not been saved:
if (crmForm.FormType==1)
{
document.all._MBcrmFormSaveAndClose.style.display='none';
}




