org.apache.cocoon.forms.formmodel
Class CaptchaField
java.lang.Object
org.apache.cocoon.forms.formmodel.AbstractWidget
org.apache.cocoon.forms.formmodel.Field
org.apache.cocoon.forms.formmodel.CaptchaField
- All Implemented Interfaces:
- ValueChangedListenerEnabled, DataWidget, SelectableWidget, Widget, ValidationErrorAware, Locatable
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 1304258 2012-03-23 10:09:27Z ilgrosso $
- See Also:
- captcha.net
Fields inherited from class org.apache.cocoon.forms.formmodel.Field |
enteredValue, required, selectionList, SUGGESTED_LABEL_ATTR, suggestionList, validationError, value, VALUE_DISPLAY_PARSE_ERROR, VALUE_DISPLAY_VALIDATION, VALUE_PARSE_ERROR, VALUE_PARSED, VALUE_UNPARSED, VALUE_VALIDATED, VALUE_VALIDATING, valueState |
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, setSuggestionList, setSuggestionList, 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 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 |
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.
CaptchaField
public CaptchaField(CaptchaFieldDefinition fieldDefinition,
Context avalonContext)
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
- Parameters:
contentHandler
- to send the SAX events tolocale
- in which context potential content needs to be put.
- Throws:
SAXException
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.