org.apache.cocoon.forms.formmodel
Class CaptchaField

java.lang.Object
  extended byorg.apache.cocoon.forms.formmodel.AbstractWidget
      extended byorg.apache.cocoon.forms.formmodel.Field
          extended byorg.apache.cocoon.forms.formmodel.CaptchaField
All Implemented Interfaces:
DataWidget, org.apache.cocoon.util.location.Locatable, SelectableWidget, ValidationErrorAware, ValueChangedListenerEnabled, Widget

public class CaptchaField
extends Field

A Field for CAPTCHA validation. Upon generation, a secret random string is stored in a session attribute having a randomly generated name, for use by a CaptchaValidator.
Usage sample:

    <fd:captcha id="f1" required="true">
      <fd:label>Copy the number shown into the input field</fd:label>
      <fd:datatype base="string"/>
      <fd:validation>
        <fd:captcha/>
      </fd:validation>
    </fd:captcha>
 

Version:
$Id: CaptchaField.html 1304280 2012-03-23 11:18:01Z ilgrosso $
See Also:
captcha.net

Field Summary
protected static SecureRandom random
          Random number generator used to create session attribute name.
static String SESSION_ATTR_PREFIX
           
 
Fields inherited from class org.apache.cocoon.forms.formmodel.Field
enteredValue, required, selectionList, SUGGESTED_LABEL_ATTR, validationError, value, VALUE_DISPLAY_PARSE_ERROR, VALUE_DISPLAY_VALIDATION, VALUE_PARSE_ERROR, VALUE_PARSED, VALUE_UNPARSED, VALUE_VALIDATED, VALUE_VALIDATING, valueState
 
Fields inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget
wasValid
 
Fields inherited from interface org.apache.cocoon.forms.formmodel.Widget
PATH_SEPARATOR
 
Constructor Summary
CaptchaField(CaptchaFieldDefinition fieldDefinition, org.apache.cocoon.processing.ProcessInfoProvider processInfoProvider)
           
 
Method Summary
 void generateItemSaxFragment(ContentHandler contentHandler, Locale locale)
          Generates nested additional content nested inside the main element for this widget which is generated by AbstractWidget.generateSaxFragment(ContentHandler, Locale) The implementation on the AbstractWidget level inserts no additional XML.
 
Methods inherited from class org.apache.cocoon.forms.formmodel.Field
addValueChangedListener, applyWhitespaceTrim, broadcastEvent, getDatatype, getDefinition, getFieldDefinition, getSuggestionLabel, getSuggestionList, getValidationError, getValue, getXMLElementAttributes, getXMLElementName, hasValueChangedListeners, initialize, isRequired, isSuggested, readFromRequest, readFromRequest, removeValueChangedListener, setRequired, setSelectionList, setSelectionList, setSelectionList, setSuggestionLabel, setValidationError, setValue, validate
 
Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget
addValidator, generateDisplayData, generateLabel, generateSaxFragment, getAttribute, getChild, getCombinedState, getForm, getFullName, getId, getLocation, getName, getParent, getRequestParameterName, getState, getWidget, isValid, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState, toString, widgetNameChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.forms.formmodel.Widget
addValidator, generateLabel, generateSaxFragment, getAttribute, getCombinedState, getForm, getFullName, getId, getLocation, getName, getParent, getRequestParameterName, getState, getWidget, isValid, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState
 

Field Detail

SESSION_ATTR_PREFIX

public static final String SESSION_ATTR_PREFIX
See Also:
Constant Field Values

random

protected static final SecureRandom random
Random number generator used to create session attribute name.

Constructor Detail

CaptchaField

public CaptchaField(CaptchaFieldDefinition fieldDefinition,
                    org.apache.cocoon.processing.ProcessInfoProvider processInfoProvider)
Method Detail

generateItemSaxFragment

public void generateItemSaxFragment(ContentHandler contentHandler,
                                    Locale locale)
                             throws SAXException
Description copied from class: AbstractWidget
Generates nested additional content nested inside the main element for this widget which is generated by AbstractWidget.generateSaxFragment(ContentHandler, Locale) The implementation on the AbstractWidget level inserts no additional XML. Subclasses need to override to insert widget specific content.

Overrides:
generateItemSaxFragment in class Field
Throws:
SAXException


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.