November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I am guessing this is the reason: The PageData object will not let the web control set an empty value since PageName is an required property.
Actually I see problem in Validation process. Main question is "Why PageData has old values instead new entered?" The second question: "How can I manage property's value during validation?" Can or can not I set some properties on validation stage to values depended on values from others properties?
PS: I want to avoid usage Java Script and client side validation.
At last time validation works well. I had newly entered data. I had one problem, I don't know which button was clicked - Saved or Saved & Publish during validation. As result I have to catch Saving event. Is it correct to validate data on Saving stage?
The Saving event can be you used to change data before it gets saved or cancel a save if something is wrong with the data. Its not the best way to validate data since you have no good way of returning error messages to the user.
We return message by setting ErrorMessage property. It works OK. But we have to use the same validation for Publishing event. It works ok and display message when we click Save and Publish button in EditPanel, but when we Publish page from Version List Tab, then we have stack traced exception and I suppose it's problem of CMS. It doesn't expect cancellation Publish action in Version List Tab.
How do you think, we should try to catch fired exception or it will be fixed by EPI?
It looks like that:
[EPiServerCancelException: Main section can be published with at least 5 teasers ] EPiServer.Core.PageStoreBase.RaiseCancellablePageEvent(Object key, String defaultReason, PageEventArgs eventArgs) +129 EPiServer.DataFactory.Save(PageData page, SaveAction action, AccessLevel access) +218 EPiServer.DataFactory.Save(PageData page, SaveAction action) +183 EPiServer.UI.Edit.VersionListControl.VersionList_ItemCommand(Object source, DataGridCommandEventArgs e) +590 System.Web.UI.WebControls.DataGrid.OnItemCommand(DataGridCommandEventArgs e) +108 System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +81 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +123 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 EPiServer.UI.WebControls.ToolButton.OnCommand(CommandEventArgs e) +117 EPiServer.UI.WebControls.ToolButton.RaisePostBackEvent(String eventArgument) +187 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Where the ErrorMessage are "Main section can be published with at least 5 teasers" was set by me on Publish stage.
It happens in Version List on Publish. I expect to see more user friendly message as for Edit Panel warning messages.
I tryed to validate PageData before saving. Realy I need to check PageName and if it's emty then set value from another property.
When I reseived event all properties have old values, PageName wasn't empty but just a moment ago I cleared one in EditMode. Then I can see a warning about empty PageName during saving page.