Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1383

number translator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 4.0, 4.1.1
    • 4.1.2
    • Framework
    • None
    • 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.

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            arthur Arthur Wiedmer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: