EPiFields, edit mode & Validators

Vote:
 
We're using EPiFields to insert custom forms (web user controls) into pages. The custom forms contain required field validators which appear to be firing in edit mode of EPiServer which is preventing "Save & Publish". We're just getting a blank warning box appearing (no message) which I can only stop occuring if I remove the required field validators. Does anyone know how I can detect that I'm in edit mode and therefore disable the validators to allow the page to be published? Maybe there's another trick that I'm missing? Thanks, Justin
#12739
Mar 25, 2008 18:35
Vote:
 
Hi, Until someone from EP responds, you might take a look at http://www.episerver.com/en/EPiServer_Knowledge_Center/developerforum/EPiServer-Developer-Forums-/1805/4125/ For example, we used something like the following for this: public ViewMode CurrentViewMode { get { if (Request.UrlReferrer != null) { string startUrl = Request.UrlReferrer.ToString(); string editMatchString = "/" + Configuration.EditDir; string adminMatchString = "/" + Configuration.AdminDir; bool isAdmin = Regex.IsMatch(startUrl, adminMatchString, RegexOptions.IgnoreCase); bool isEdit = Regex.IsMatch(startUrl, editMatchString, RegexOptions.IgnoreCase); if (isAdmin) return ViewMode.Admin; else if (isEdit) return ViewMode.Edit; } return ViewMode.View; } } .. and .. public enum ViewMode { Edit, Admin, View };
#14811
Mar 25, 2008 18:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.