ePages 6.10 - DE_EPAGES/TLE/API/FormHandler.pm

Package DE_EPAGES::TLE::API::FormHandler

This package provides functions to switch the form error handling on/off. §note This file was renamed from ./FormErrorHandler.pm

Functions

ERROR_VALUE
FORM_ARRAY
FORM_ERROR
WITH_ERROR

ERROR_VALUE

This tle function allows to set a tle depending on FormError status.

Syntax
#FUNCTION("ERROR_VALUE", #ValueIfError, #ValueIfNoError)
Example
#WITH_ERROR(#FormError)
 <input name="Alias" value="#Alias">
  #LOCAL("RefUnitID", #FUNCTION("ERROR_VALUE", #RefUnit, #RefUnit.ID))
 <select name="RefUnit" size="1">
   <option value="">{EmptyEntry}</option>#LOOP(#Shop.Units)
   <option value="#ID"#IF(#RefUnitID AND #RefUnitID NEQ #ID) selected="1"#ENDIF>#IF(#Name)#Name#ELSE#Alias#ENDIF</option>#ENDLOOP
 </select>
  #ENDLOCAL
#ENDWITH_ERROR
Input
$Processor (object)
tle processor
$raParams (ref.array.string)
tle function parameter
$cTemplate (ref.*)
template code for replaceTLEs
Return
$Value (string)
template string

FORM_ARRAY

Treats a string from the INPUT Hash as an array representation and returns an array reference of hashes. Each array element is a hash containing an element with the key "Element", that references the original array element value.

Syntax
#FORM_ARRAY(#InputName)
Example
#FORM_ARRAY("Elements")
#LOOP(#FORM_ARRAY("Elements"))#Element#ENDLOOP
Input
#InputName (string)
input name

FORM_ERROR

This tle function allows to get FormError_InputName with a variable input name.

Syntax
#FUNCTION("FORM_ERROR", #FieldName)
#FORM_ERROR(#FieldName)
Example
<input name="Alias"#IF(#FORM_ERROR("Alias")) style="color:red"#ENDIF value="#Alias">
Input
#FieldName (string)
input field name

WITH_ERROR

This function applies the automatic replacement of tles with the form error value. The tles will only be replaced at the current context. Important for the replacement is that the tle has the same name as the input field.

Syntax
#BLOCK("WITH_ERROR", #ReplaceOrNot) ... template ... #ENDBLOCK
#WITH_ERROR(#ReplaceOrNot) ... template ... #ENDWITH_ERROR
Example
#WITH_ERROR(#FormError)<input name="Alias" value="#Alias">#ENDWITH_ERROR
Input
$Processor (object)
tle processor
$raParams (ref.array.string)
tle function parameter
$cTemplate (ref.*)
template code for replaceTLEs
Return
$Value (string)
template string