Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Charles Zipp 20 posts 81 karma points
    Apr 11, 2011 @ 06:24
    Charles Zipp
    0

    Error handling for custom workflow types

    I was wondering if its possible to pass an exception caught in a custom workflow type and pass it to the contour form? Basically, if something goes wrong in the workflow, i want to let the user know their submission didnt complete. Any suggestions?

    I tried using the recordeventargs.context.adderror. However, that throws back the nasty .net server side error page. I want to just show the error message in the validation summary. I didnt see anything in the recordservice or record classes that looked like it would facilitate this.

  • Comment author was deleted

    Apr 11, 2011 @ 12:33

    Hi Charles,

    I'm afraid there isn't an easy way of doing this currenlty.

    But I'll add this to our issue tracker

  • Charles Zipp 20 posts 81 karma points
    Apr 11, 2011 @ 16:22
    Charles Zipp
    0

    Hey Tim,

    If I may, I would like to make a suggestion for the manner in which this is corrected. I am still pretty new to umbraco so, if for whatever reason you feel this is not a good plan, don't hesitate to point out why. Then again, this may already be something being looked at for umbraco 5 since this isvery MVC'ish.

    I think this issue brings up a bigger discussion regarding the manner in which the workflow feature is being used in Contour. Currently, the workflow is the only means by which you can run server side code on the submission of a form (as far as i know). After browsing around the forums a bit, it seems common that people use contour forms and workflow in a similar manner in which web-forms people use aspx and aspx.cs (code-behind). Also, how MVC people use views and controllers. While this may not of been the intended use of the feature it seems alot of people are moving in this direction.

    One common example i saw in the forums is creating forms for member registration, login, forgot password, etc. Basically, replacing the asp controls for membership with a contour form and a workflow type that handles the server side logic after submission. At some point down the line, you are going to need some API to accomodate server side validation (business rules). What i believe would be a really cool feature is some intergration with microsofts DataAnnotations stack. Especially, after .NET 4's introduction of the ValidationAttribute, this has been a very nice way of keeping things "DRY" in your server side logic.

    With that said, what i think would be a nice feature is to have a setting for a form that accepts a metadata class. The metadata class consist of properties that basically mirrors your form fields. Then, you are able to annotate each of the properties with attributes from the DataAnnotations stack. The contour form would be validated against the metadata class, any errors found would be caught and presented in either the validation summary or field span that holds the error for an individual field. From the API side, there probably needs to be an "Errors" object property on the Form object. That errors object would be what collects any validation issues from the server side code and then sends them back to the client.

    A little more verbose than intended :)

  • Charles Zipp 20 posts 81 karma points
    Apr 23, 2011 @ 17:06
    Charles Zipp
    0

    I believe this is the only workaround for right now for what i was trying to do. The idea i had was setting a session variable in the workflow type and then catching it in the custom render form user control. Also, may be able to implement a custom validator to handle the server side validation i needed before ever going to the workflow type. If this works out i'll post the solution.

    http://farmcode.org/post/2010/03/26/Regionalizing-validation-messages-and-regex-in-Umbraco-Contour.aspx

Please Sign in or register to post replies

Write your reply to:

Draft