OFBiz
  1. OFBiz
  2. OFBIZ-3473

SimpleMapProcessor don't stop after the first error

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: SVN trunk
    • Fix Version/s: SVN trunk
    • Component/s: framework
    • Labels:
      None

      Description

      Hi @all,

      the SimpleMapProcessor don't stop the validation for a given field after the first error.

      For example:
      I need to validate a birthdate from an input field. So I process two validation for the field:
      1. isDate
      2. isDateBeforeToday

      If the string is not a proper date, the process should stop here, because the secand validation would throw an exception.

      I modified this. Hopefully you like it

      Dimitri

        Activity

        Hide
        David E. Jones added a comment -

        The description isn't totally clear on the code that produced this behavior, but based on the description it sounds like this is what it should be doing.

        This patch should not be committed. If it was committed it would break and/or impede the function of existing code.

        The intent of simple-method validation is to allow for a set of validations to be done and then the result of all of them reported back to a user so that they don't get stuck in a frustrating loop of having to deal with one issue at a time (a real nightmare for large forms).

        In your simple-method you can quit any time with the check-errors operation. For more information about both of these parts of the simple-methods, please read the MiniLang Guide.

        Show
        David E. Jones added a comment - The description isn't totally clear on the code that produced this behavior, but based on the description it sounds like this is what it should be doing. This patch should not be committed. If it was committed it would break and/or impede the function of existing code. The intent of simple-method validation is to allow for a set of validations to be done and then the result of all of them reported back to a user so that they don't get stuck in a frustrating loop of having to deal with one issue at a time (a real nightmare for large forms). In your simple-method you can quit any time with the check-errors operation. For more information about both of these parts of the simple-methods, please read the MiniLang Guide.
        Hide
        Dimitri Unruh added a comment -

        David,

        sorry, I don't agree with you. Maybe my description was not so clear, so I try it again:

        Have a look at the following example:

        <simple-map-processor name="newPerson">
        <process field="USER_FIRST_NAME">
        ....
        </process>
        <process field="...">
        ....
        </process>
        <process field="birthDate ">
        <not-empty><fail-property .... /></not-empty>
        <validate-method method="isDate"><fail-property .../></validate-method>
        <validate-method method="isDateBeforeToday"><fail-property .../></validate-method>
        </process>
        <process field="...">
        ....
        </process>
        </simple-map-processor>

        1. case: we got an empty value for birthDate
        Message: "birthDate is a required field"

        2. case: birthDate is 12/12/2020
        Message: "birthDate is invalid because you are not M.J.Fox "

        3. case: birthDate is "abc"
        Messages: "birthDate has a from format" and "birthDate is invalid because you are not M.J.Fox "

        And that's the pont: the second message is (in my optinion) a failure here. You talking about frustrating a user, I guess this one would let him stop the process (just look at some useability studies for ecommerce).
        We have to tell a user everytime what is going on and give him an exact message as a feedback to his input.

        I hope this makes my intention more clear, so I will reopen this issue.

        Dimitri

        Show
        Dimitri Unruh added a comment - David, sorry, I don't agree with you. Maybe my description was not so clear, so I try it again: Have a look at the following example: <simple-map-processor name="newPerson"> <process field="USER_FIRST_NAME"> .... </process> <process field="..."> .... </process> <process field="birthDate "> <not-empty><fail-property .... /></not-empty> <validate-method method="isDate"><fail-property .../></validate-method> <validate-method method="isDateBeforeToday"><fail-property .../></validate-method> </process> <process field="..."> .... </process> </simple-map-processor> 1. case: we got an empty value for birthDate Message: "birthDate is a required field" 2. case: birthDate is 12/12/2020 Message: "birthDate is invalid because you are not M.J.Fox " 3. case: birthDate is "abc" Messages: "birthDate has a from format" and "birthDate is invalid because you are not M.J.Fox " And that's the pont: the second message is (in my optinion) a failure here. You talking about frustrating a user, I guess this one would let him stop the process (just look at some useability studies for ecommerce). We have to tell a user everytime what is going on and give him an exact message as a feedback to his input. I hope this makes my intention more clear, so I will reopen this issue. Dimitri
        Hide
        elan added a comment -

        Does SimpleMapProcess know that it shall stop at which error ?
        It may be better to simplify the error message at invoker process while SimpleMapProcess just return all error.

        Show
        elan added a comment - Does SimpleMapProcess know that it shall stop at which error ? It may be better to simplify the error message at invoker process while SimpleMapProcess just return all error.

          People

          • Assignee:
            David E. Jones
            Reporter:
            Dimitri Unruh
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development