7 Replies Latest reply on Jun 14, 2007 10:43 AM by ricardomarques

    Validating user input

    ricardomarques

      Hi

      From what i have get until now, please correct me if I am wrong, at process design level, we can't declare variable types, only string variables, so... in some cases those strings must be cast\converter to other formats on the java code (actions).

      So... is there some way to specify the kind of validation that a variable must suffer at user input level? I assume that's nothing out of the box to this, and I trying to figure out the best\simple way to do this.

        • 1. Re: Validating user input

           

          From what i have get until now, please correct me if I am wrong, at process design level, we can't declare variable types, only string variables, so... in some cases those strings must be cast\converter to other formats on the java code (actions).


          No. Please read the user guide before posting questions.

          So... is there some way to specify the kind of validation that a variable must suffer at user input level? I assume that's nothing out of the box to this, and I trying to figure out the best\simple way to do this.


          Yes, you're on your own, although JSF certainly provides a lot of framework.

          -Ed Staub


          • 2. Re: Validating user input

            ... to be more explicit - you can't declare variable types, but the "only string variables" is way off.

            • 3. Re: Validating user input
              kukeltje

              correct, you cannot realy declare them, but a 'script' can be used to set variables including (value and also type)

              • 4. Re: Validating user input
                ricardomarques

                So using bean shell script on process definition is the best way to do it? On that case the validation is on the script, and i wanted at the user level.

                I was thinking on defining a regular expression on jpdl that I could access throut the API, and validate on user level, don't know if it is the best approach.

                • 5. Re: Validating user input
                  kukeltje

                  correct, it is not possible to put validation definitions in the processdefinition. A regexp (or anything in line with hibernate validators or whatever) is possible. Maybe reusing those kinds of validations is the most interesting. Putting it on the domainmodel is imo good practice.

                  • 6. Re: Validating user input
                    roccolocko

                    As you may now know, you can store many kinds of variables on the jbpm, since in the desing you're only giving names to them, and not setting types.

                    Although you do can make some validation of this variables with bean shell, I would recomend that you make the validations before you put them on jbpm, for example with Validator in case you are using JSF.

                    • 7. Re: Validating user input
                      ricardomarques

                       

                      "roccolocko" wrote:
                      Although you do can make some validation of this variables with bean shell, I would recomend that you make the validations before you put them on jbpm, for example with Validator in case you are using JSF.


                      That's my ideia! But I need to have something at process design level that tells what can of validation I will apply to a variable.

                      I'm wondering on the process definition where would be the best place for that on the process definition.