Aug 20, 2015 at 7:17 PM
I am trying to validate data of a content item being submitted via a custom form.
- I Turned off "Create Content On Submission"
- I added a validation step to my custom workflow
- When the validation passes, I want to persist my item to the DB.
- The Custom Forms module passes a ContentItem to the Workflows context so you can do things like publish and delete content items so I figure this would be fine.
- In the module I take the content item that is passed and do the following :
var contentItem = workflowContext.Content.ContentItem;
yield return T("Done");
- This results in the data being persisted to the Orchard_Framework_ContentItemRecord table instead of in the Orchard_Framework_ContentItemVersionRecord table, which is why I believe I don't see any data under "Submissions" in the UI.
The Custom Forms module create's a new Content Item, and I have the same code as if I was asking it to save it via the Custom Forms module so it is confusing.
In the CREATEPOST controller for forms :
var customForm = form.As<CustomFormPart>();
var contentItem = _contentManager.New(customForm.ContentType);
This contentItem get's passed along to the workflows.