Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 4.0, 4.1.1
    • Fix Version/s: 4.1.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      windows 2k professional, tomcat 4.1.24, j2sdk 1.4.2_13, eclipse 3.2.1

      Description

      • define html with an input field (going to capture a number with pattern #.##)
      • define translator: <binding name="translator" value="translator:number,pattern=#.##" />
      • define validators: <binding name="validators" value="validators:min=-1.23,max=20.12" />
      • code onSubmit listener for the form:
        public String onSubmit (IRequestCycle cycle) {
        ValidationDelegate delegate = (ValidationDelegate) ((IForm) getComponent("stockQuoteForm")).getDelegate();

      System.out.println("***");
      System.out.println(getStockPrice());
      if (delegate.getHasErrors()) {
      List ut = delegate.getAssociatedTrackings();
      if (ut != null && ut.size() > 0)

      { System.out.println("***"); System.out.println(((IFieldTracking) ut.get(0)).getErrorRenderer().toString()); }

      return null;
      }
      System.out.println("should not reach here if enter " + getStockPrice());
      return null;
      }
      }

      Test and result:

      • enter 0.123 to the input field and submit the form
      • console output messages:
        ***
        0.123
        should not reach here if enter 0.123
      • As the input not conform to the pattern, it should fail the input. If it pass the input, it should trim the number for me i.e. return 0.12 when calling getStockPrice(), it is found that the screen just refresh with 0.12 silently but internally, it is accepted the input.

        Activity

        Arthur Tam created issue -
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Fix Version/s 4.1.2 [ 12312202 ]
        Hide
        Arthur Tam added a comment -

        Problem remains, lib used:

        backport-util-concurrent-3.0.jar
        commons-beanutils-1.7.0.jar
        commons-codec-1.3.jar
        commons-fileupload-1.1.1.jar
        commons-io-1.1.jar
        commons-lang-2.2.jar
        commons-logging-1.0.3.jar
        hivemind-1.1.1.jar
        hivemind-lib-1.1.1.jar
        javassist-3.4.jar
        ognl-2.7-20070325.025541-16.jar
        oro-2.0.8.jar
        tapestry-annotations-4.1.2-20070321.174345-32.jar
        tapestry-contrib-4.1.2-20070321.174345-34.jar
        tapestry-framework-4.1.2-20070321.174345-38.jar
        tapestry-portlet-4.1.2-20070321.174345-32.jar

        Show
        Arthur Tam added a comment - Problem remains, lib used: backport-util-concurrent-3.0.jar commons-beanutils-1.7.0.jar commons-codec-1.3.jar commons-fileupload-1.1.1.jar commons-io-1.1.jar commons-lang-2.2.jar commons-logging-1.0.3.jar hivemind-1.1.1.jar hivemind-lib-1.1.1.jar javassist-3.4.jar ognl-2.7-20070325.025541-16.jar oro-2.0.8.jar tapestry-annotations-4.1.2-20070321.174345-32.jar tapestry-contrib-4.1.2-20070321.174345-34.jar tapestry-framework-4.1.2-20070321.174345-38.jar tapestry-portlet-4.1.2-20070321.174345-32.jar
        Hide
        Arthur Tam added a comment -

        f.y.i.

        I changed NumberTranslator to accept one more param: mask (a regular expression) s.t. parseText() only parse the input when it conforms to a mask (if provided)
        Use the mask: \d*\.?\d?\d? supplement the pattern #.##, it will fail the input 0.123

        Show
        Arthur Tam added a comment - f.y.i. I changed NumberTranslator to accept one more param: mask (a regular expression) s.t. parseText() only parse the input when it conforms to a mask (if provided) Use the mask: \d*\.?\d?\d? supplement the pattern #.##, it will fail the input 0.123
        Hide
        Jesse Kuhnert added a comment -

        If you want to have an exact number of characters just give your pattern something like "0.000" instead and it will do what you want.

        Show
        Jesse Kuhnert added a comment - If you want to have an exact number of characters just give your pattern something like "0.000" instead and it will do what you want.
        Jesse Kuhnert made changes -
        Assignee Jesse Kuhnert [ jkuhnert ]
        Resolution Invalid [ 6 ]
        Status Open [ 1 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12400265 ] Default workflow, editable Closed status [ 12569211 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569211 ] jira [ 12590469 ]

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Arthur Tam
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development