November Happy Hour will be moved to Thursday December 5th.

GlobalPageValidation

Vote:
 

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.

#36265
Jan 22, 2010 8:00
Vote:
 

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.

#36273
Jan 22, 2010 9:41
Vote:
 

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.

#36420
Jan 28, 2010 7:12
Vote:
 

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?

#36454
Jan 29, 2010 6:35
Vote:
 

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.

#36457
Jan 29, 2010 9:26
Vote:
 

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?

#36460
Jan 29, 2010 9:55
Vote:
 

Which exception + stack trace are you getting ?

#36476
Jan 29, 2010 13:07
Vote:
 

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.

#36513
Feb 01, 2010 8:50
Vote:
 

I have registered it as a bug.

#36533
Feb 02, 2010 8:35
Vote:
 

Thanks a lot for your support.

#36544
Feb 02, 2010 15:12
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.