protected RequiredTextField < String > newRequiredTextField ( final String id , final IModel < CaptchaModelBean > model ) { // Create an TextField for the input... final RequiredTextField < String > captchaInput = new RequiredTextField < String > ( "captchaInput" , new PropertyModel <> ( model , "captchaInput" ) ) { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L ; /** * {@inheritDoc} */ @ Override protected final void onComponentTag ( final ComponentTag tag ) { super . onComponentTag ( tag ) ; // clear the field after each render tag . put ( "value" , "" ) ; } } ; captchaInput . setType ( String . class ) ; return captchaInput ; }
Factory method for creating a new RequiredTextField . This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a RequiredTextField .