1
0
-1

Hi everyone,

Is it possible to use "Save as Draft with Validation" function but to validate only for certain fields not all? 

Thank you!

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      If you are in a process flow activity form, clicking "Save as Draft" will BYPASS all validations. In forms without such button, clicking "Save/Submit" will enforce ALL validations.

      With these expectations in mind, it would NOT be possible to enable selective validations while clicking "Save as Draft" as in the core code, it will BYPASS all validations.

      Having said so, the case is different when we are clicking "Save/Submit" will enforce ALL validations.

      For example, in specific form fields, we can add beanshell to explicitly not to validate when validation kicks in.

      For example, we add this beanshell validator into a field called "reason" and we only need user to fill in reason when "status == Sorry"

      String status = formData.getRequestParameter("status");
      if(status.equalsIgnoreCase("Sorry")){
      	if(value.equalsIgnoreCase("")){
      		//reason is empty
      		formData.addFormError(id, "You must give reason when you are sorry.");
      		return false;
      	}else{
      		return true;
      	}
      }

      More at Bean Shell Programming Guide#UseasFormValidator

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi, what do you mean by  "Save as Draft with Validation"? Saving as draft by definition should not have any validation, since draft means that something still in progress and not ready for submission.

          CommentAdd your comment...