SiteVision Onlinehelp
Search

Input rendering

Field input templates are used when rendering the form that users should fill out and submit. The JavaScript is executed first and can therefore be used when populating default values and the Velocity template is used afterwards to generate the HTML code containg input tags.

Variables declared in JavaScript are available under their names in Velocity.

##
## Utilites and misc properties
#set ($propertyUtil = $sitevisionUtils.getPropertyUtil())
#set ($endecUtil = $sitevisionUtils.getEndecUtil())
#set ($labelFont = $propertyUtil.getNestedString($portlet, 'labelFont', 'selectorText'))
#set ($inputFont = $propertyUtil.getNestedString($portlet, 'inputFont', 'selectorText'))
#set ($errorFont = $propertyUtil.getNestedString($portlet, 'errorFont', 'selectorText'))

##
## Get properties from subscript
#set ($givenNameRef = $portlet.getNode("Form/Personal information/Given name"))
#set ($id = $propertyUtil.getString($givenNameRef, "id"))
#set ($type = $propertyUtil.getString($givenNameRef, "type"))
#set ($question = $propertyUtil.getString($givenNameRef,"question",""))

##
## Render label
<label class="$labelFont" for="$id">$question</label>
<br />

##
## Render input tag avoiding XSS problems
#if ($values.containsKey($givenNameRef))
   #set ($value = $values.get($givenNameRef))
#else
   #set ($value = "")
#end
<input class="$inputFont" id="$id" name="$id" type="$type" value="$endecUtil.escapeXML($value)"/>
<br />

##
## Render error message (if any)
#if ($messages.containsKey($givenNameRef))
   <span class="$errorFont">$messages.get($givenNameRef)</span>
   <br />
#end

Last updated:

se-sto-pio-sv5-2.sitevision-cloud.net
18.118.93.123