My project team has been wrestling with a rather annoying "feature" of custom MOSS 2007 forms. We have ASP.NET validation controls (RequiredFieldValidators and RegularExpressionValidators) on the pages, which makes perfect sense when you're collecting form data.

However, while editing the page, placing the form on the page, and setting whatever properties are required, the validation executes, and sometimes prevents you from saving the page. If you can enter valid data in each field, that's a workaround — but some of the fields are dropdowns and populated from a list, and during editing, they aren't populated, so there's no way to enter valid data.

I found that there is a property on the SPContext object which indicates whether the form is in Edit mode. You can use this in the CreateChildControls method to enable / disable the validator controls; basically, you only want them to be enabled when the form is in "Display" mode. Here's a sample:

// enable validation only if the form is in regular display mode
this.rfvProductType.Enabled = SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Display;
this.rfvOrigin.Enabled = SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Display;

Now, when you edit the form, the validation won't be triggered at all until the page has been edited. Works great!