Tapestry 5.4.3 Demos (in progress) : N2WTextField (Number To Word)

A text input field which displays the integral part of a number in word as the number is entered. For example, if 120.23 is entered, the word 'one hundred twenty' would be displayed next to or below (depending on parameter wordPosition) the text field. If a non-numeric field is entered, an error message (parameter errorMsg) will appear. The above validation is done by the javascript function w2n_isValid(x). w2n_isValid only provides basic validation on numeric values. Note that for a number ending with a dot (eg 123.), w2n_isValid() returns true! This component is compatible with the usual Tapestry translator and validator. The validation done by w2n_isValid(x) has nothing to do with the Tapestry validation framework. This component is a subclass of the AbstractTextField component and should be used within Form component.

In addition to the parameters of the AbstractTextField, the N2WTextField has the following parameters.
Parameter name Type Required Default Default Prefix Description
wordPosition java.lang.String no SAME_LINE literal The position of the word to be displayed relative to the input text field. The possible values are SAME_LINE and BELOW.
commaFlag boolean no false prop If true, the word displayed will include commas and/or full stops. eg : For 101001, one hundred one thousand, twenty. Otherwise, a word will be displayed without commas, nor full stops. eg : For 101001, one hundred one thousand twenty
wrapFlag boolean no false prop wrapFlag is only applicable to wordPosition BELOW. If true, the word (if it is long enough) will be displayed in multi-line
 eg : one thousand, 
      two hundred thirty three. 
If false, the word will be displayed in a single line.
errorCSS java.lang.String no   literal The css class name for the error message.
wordCSS java.lang.String no   literal The css class name for the word.
errorMessage java.lang.String no Please enter a numeric value. literal The error message to be displayed when the entered number is not numeric (when the javascript function w2n_isValid(x) returns false).

Online demo