Interface FieldHandler
-
- All Known Implementing Classes:
HoneypotHandler
,SelectionHandler
,TextareaHandler
,TextfieldHandler
public interface FieldHandler
A service interface for registering services to handle a form field.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static String
getName(org.apache.sling.api.resource.Resource fieldResource)
void
handleField(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource fieldResource, Map<String,Object> formData)
Handle the field being submitted.boolean
handles(org.apache.sling.api.resource.Resource fieldResource)
Returns true if the FieldHandler should handle the field resourcestatic boolean
isRequired(org.apache.sling.api.resource.Resource fieldResource)
-
-
-
Method Detail
-
handles
boolean handles(org.apache.sling.api.resource.Resource fieldResource)
Returns true if the FieldHandler should handle the field resource- Parameters:
fieldResource
- the field resource to handle- Returns:
- true if the FieldHandler will handle, false otherwise
-
handleField
void handleField(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource fieldResource, Map<String,Object> formData) throws FormException
Handle the field being submitted. Uses the configuration from the fieldResource and the data from the request and saves the value into the formData.- Parameters:
request
- the request for the form submissionfieldResource
- the resource from which to get the field configurationformData
- the Map to which to save the data for the field- Throws:
FormException
- an exception occurs attempting to handle the field including the field not being set or being invalid
-
isRequired
static boolean isRequired(org.apache.sling.api.resource.Resource fieldResource)
-
getName
static String getName(org.apache.sling.api.resource.Resource fieldResource)
-
-