All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tapestry5.corelib.components.TextField.xdoc Maven / Gradle / Ivy

Go to download

Central module for Tapestry, containing interfaces to the Java Servlet API and all core services and components.

There is a newer version: 5.8.6
Show newest version

    
        

Once again, we're basing the example on the order payment screen from the Radio examples. This time we're focusing in on the text field used for entering the credit card number, and we're going to validate that number using a regular expression:

: ]]>

The validate parameter is used to specify validations for the field. When it is omitted, the @Validate annotation of the property is used (if present). In any case, this references two of the built-in validations: "required" and "regexp".

This example presumes that the Payment page includes a property named "cardNumber".

The "required" validation requires no extra configuration. On the other hand, "regexp" needs to know the regular expression to enforce ... and it should also have a user presentable message.

Tapestry uses the page's message catalog as a source of extra validation information. The key is the component id, the name of the validation. The value is given to the validator object ... here it's the regular expression for a credit card number (four sets of four digits, optionally seperated by dashes). The "-message" entry allows the normal error message for the validator to be overridden.

These same approaches apply consistently to all form control element components.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy