Question

Photo of Ken Roach

0

How can I validate fields in workflow forms?

I have a field in a workflow registration form: 'I accept the privacy policy.'  If the user does not select 'yes' I don't want to proceed, but would like to see an error message like the one that appears for mandatory fields.  How can I do this?

Another example would be requesting an email address, then asking for the email address to be entered again to confirm it was entered correctly, and checking to see if they are the same and giving an error message if they were different.  Is there a way to do this?

  • Ken Roach

    I can get around the privacy policy issue by using a Single Select field type that is mandatory, with only a Yes option, and setting the defaul to None. E.g. "Do you accept the privacy policy ? o Yes." If the user does not tick the yes, then the form errors saying the field 'Pricacy Policy is required.' This is fine.


    Field Validation:
    I can check the email this way: Have two fields: EmailAddress1 and EmailAddress2. Add an action after the Prompt User action that is a conditional check: Test if EmailAddress1 Not Equal to Attribute Value EmailAddress2. If it is not, then Activate Activity 'Request' to redisplay the Request form. All well and good, but there is no way to set or give an error message. What would be really cool would be to be able to hook into the error message that is set when mandatory fields are not completed. If this error message could be manually set, that would work.


    The LogError action displays an error, but doesn't take the user back to the form - it just displays the error message with no where to go. Maybe add a NEW ACTION type: 'Log User Form Error' could be used that would allow me to enter an error message (as does Log Error), but then displays this error message at the top of the next form that is displayed.

  • Photo of Ken Roach

    0

    Ok, here's how to do this:  Add another Activity after the Request activity that captures the initial form data.

    Add an action of User Entry Form type.

    MAke it conditional: If EmailAddress1 Not Equal EmailAddress2

    Set the Form Header as follows:

    emerr.JPG

    and then only select the fields that the user needs to correct (in this case the two email fields).

    (This is restricted to checking only one condition at a time.  Maybe an enhancement would be to allow checking multiple form conditions so the error message could display all validity errors at once, rather than one at a time.)