Interface Form


  • @ProviderType
    public interface Form
    • Method Detail

      • getName

        String getName()
        Get the Form's name

        This should uniquely identify a Form on a Page

        Returns:
      • setName

        void setName​(String name)
        Sets the Form name

        Typically this setter is not used and Form names are set in constructor.

        This can be helpful for changing the flow or using Form X to populate Form Y

        Parameters:
        name -
      • getResourcePath

        String getResourcePath()
        Get the Form's resource path
        Returns:
      • setResourcePath

        void setResourcePath​(String resourcePath)
        Sets the Form's resource path
        Parameters:
        resourcePath -
      • getData

        Map<String,​String> getData()
        Gets a Map of the Form data
        Returns:
      • getErrors

        Map<String,​String> getErrors()
        Gets a Map of the error data
        Returns:
      • has

        boolean has​(String key)
        Determines if a Form data key exists and has non-blank data
        Parameters:
        key -
        Returns:
      • get

        String get​(String key)
        Gets the data associated with a Form data key
        Parameters:
        key -
        Returns:
      • set

        void set​(String key,
                 String value)
        Sets Form data
        Parameters:
        key -
        value -
      • hasData

        boolean hasData()
        Determines if any Form Data exists; atleast 1 key w non-blank data must exist in the data map.
        Returns:
      • hasError

        boolean hasError​(String key)
        Determines if an error exists
        Parameters:
        key -
        Returns:
      • getError

        String getError​(String key)
        Gets the error message
        Parameters:
        key -
        Returns:
      • setError

        void setError​(String key)
        Sets an error

        This is used if no corresponding error message/data is required to be associated; and the only information required is that an error occurred against key X.

        Parameters:
        key -
      • setError

        void setError​(String key,
                      String value)
        Sets an error for key with corresponding error message/data
        Parameters:
        key -
        value -
      • hasErrors

        boolean hasErrors()
        Checks if has data
        Returns:
      • getValueMap

        org.apache.sling.api.resource.ValueMap getValueMap()
        Get data as ValueMap
        Returns:
      • getErrorsValueMap

        org.apache.sling.api.resource.ValueMap getErrorsValueMap()
        Get Errors as ValueMap
        Returns: