Packages » Package freeform » Class CaptchaInputField

Class CaptchaInputField

Declaration:
<? class CaptchaInputField extends InputField ?>

Description:
This input field will render the captcha image and a text input field. Upon the form submission, it will check if the entered text is the same as the text displayed on the captcha image, thus making the form valid or invalid. You can specify the image size, font file name and size, as well as the length of the captcha string. This tag will render two tags in the resulting document - one <img> tag for the captcha image, and another <input type="text"> tag for the captcha text entry. This tag accepts the following attributes for the image (in addition to the normal styling attributes that will apply to the text entry field:
  • imageclass - the class attribute that will be applied to the resulting <img> tag
  • imagestyle - the style attribute that will be applied to the resulting <img> tag
  • imagewidth - the captcha image width (defaults to 120)
  • imageheight - the captcha image height (defaults to 32)
  • position - the position of the image relative to the text input field (can be one of left, right, top, bottom). defaults to right
  • font - the name of the font file to use. The font file must reside either in the resources directory of the currentry executing action's package, or in the resources folder under the freeform package (will search in that order). This can actually contain a path relative to those directories (like fonts/myfont.ttf). Defaults to captcha.ttf
  • fontsize - the font size (in points, pt) that will be used to render the captcha text (default 14)
  • length - the lengths of the captcha text (default 5)


Parent Classes:
InputField

Authors:
  • Dennis Popel

Methods:
  • __construct()
    Create a new input filed with the given value and validator
  • getRenderer()
    Return the renderer of this field for a particular document type
  • isValid()
    Returns true if the field has not been assigned a validator, otherwise it returns result of validation