Uploaded image for project: 'Click'
  1. Click
  2. CLK-46

Regular expression based validation

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None

      Description

      Now, TextField supports length and required validation.
      In addition, Click provides some components which extended TextField such as EmailField, CreditField.
      But when I need other format validation, I must make new extended field components.

      I think the component which supports regexp based validation is useful.
      So I made this as new component named PatternField.

      ========
      PatternField field = new PatternField("java");
      field.setPattern(".+
      .java");
      ========

      To use this component, you have to add message entry to click-control.properties like following:

      ========
      field-pattern-error=

      {0}

      format must be

      {1}

      ========

        Activity

        Hide
        medgar Malcolm Edgar added a comment -

        Hi Naoki,

        thanks for the contribution. There a number of changes you will need to make for this to be included in the next release.

        1. Could you rename the class to: net.sf.click.extras.control.RegexField

        2. Could you update the source to follow the Click Extras Coding Style and Practices. Please see:

        http://click.sourceforge.net/docs/extras.html

        3. Could you provide a demonstration Page and template for inclusion in click-examples

        Thanks for your help.

        regards Malcolm Edgar

        Show
        medgar Malcolm Edgar added a comment - Hi Naoki, thanks for the contribution. There a number of changes you will need to make for this to be included in the next release. 1. Could you rename the class to: net.sf.click.extras.control.RegexField 2. Could you update the source to follow the Click Extras Coding Style and Practices. Please see: http://click.sourceforge.net/docs/extras.html 3. Could you provide a demonstration Page and template for inclusion in click-examples Thanks for your help. regards Malcolm Edgar
        Hide
        takezoe Naoki Takezoe added a comment -

        Hi Malcolm ,

        I attached "RegexField.zip", this contains corrected RegexField, patches for click-extras.properties and an example page.

        Regards.

        Show
        takezoe Naoki Takezoe added a comment - Hi Malcolm , I attached "RegexField.zip", this contains corrected RegexField, patches for click-extras.properties and an example page. Regards.
        Hide
        medgar Malcolm Edgar added a comment -

        Hi Naoki,

        it looks great. I have started work including it.

        regards Malcolm Edgar

        Show
        medgar Malcolm Edgar added a comment - Hi Naoki, it looks great. I have started work including it. regards Malcolm Edgar
        Hide
        medgar Malcolm Edgar added a comment -

        Checked into CVS will be available in release 0.18

        Show
        medgar Malcolm Edgar added a comment - Checked into CVS will be available in release 0.18

          People

          • Assignee:
            medgar Malcolm Edgar
            Reporter:
            takezoe Naoki Takezoe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development