DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
FORMidable by example¶
Created: | 2004-12-21T14:35:09 |
---|---|
Changed: | 2007-02-13T17:39:57 |
Author: | Jerome Schneider |
Email: | typo3dev@ameos.com |
Info 3: | http://www.ameos.com |
Info 4: |
FORMidable by example¶
Extension Key: ameos_doc_formidable_byex
Copyright 2000-2007, Jerome Schneider, <typo3dev@ameos.com>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
FORMidable by example 1
Introduction 2
How does it works ? 7
Integration of FORMidable in my plugin 7
Quick FORMidable:XML syntax 7
XML REF 8
Renderlets 8
Validators 22
Control 25
Datahandlers 26
Renderers 29
Events / server events 31
Modifiers, xml pre-compilation, xml inclusion 34
Value / default value management 35
Actionlets 36
FORMidable CORE programming 37
Using debug functionalities 38
How do I ... ? 39
Introduction¶
((generated))¶
So what's that sheet ?¶
This document presents the FORMidable API (ext: ameos_formidable)
FORMidable is an API for TYPO3 Front End used to create applications where business-logic is separated from the design and from the PHP- code.
It's configured in XML. So basically, you create a plugin, create an XML configuration file, call the FORMidable in your plugin giving XML file path as parameter and the API executes what you configured. And you're done.
It heavily relies on default behaviors so the conf can be really short. But you can also customize every single feature if you need tailor made application.
What you can do with FORMidable¶
Mainly automated forms for your website.
But what is an application, concretely ? Well:
Flexible design, textfields, formfields, and much more
Links, buttons, composite formfields, events to interact with the user
Data management (create, update, delete ), data browsing, data searching, ...
Ok i get it. Yet another Form manager.¶
The point is that every web application is based on this stuff.
FORMidable can (loves) handle this for (with) you.
How does it works ?¶
An application is entirely described in an XML file. This conf defines a lot of subsections, to configure all the elements that make your application work.
Namely:
- renderlets: objects that will be displayed in your application ( text field, listbox, link, image, button, ... )
- validators: objects checking if the data returned by a renderlet is valid, or not ( required, email, unique in db, ... )
- renderer: one per application ; will process the HTML provided by renderlets ( dev layout, templated layout, ... )
- datahandler: one per application; will execute something with produced data ( insert in base, send mail, search in database, ... )
- actionlets: objects that will be executed when datahandler finishes it's job ( redirect to a page, send an email to someone, generate a report, ... )
As said before, FORMidable needs XML as a configuration. Let's see what's inside this XML.
Integration of FORMidable in my plugin¶
To use FORMidable in your code, you have to create a FORMidable object and to initialize it with some arguments:
$this (always) : this parameter will be used to keep the reference to your plugin inside FORMidable
path to your xml file
uid of the record to edit, (optional, only if you want FORMidable to edit this record)
$this->oForm = t3lib_div::makeInstance("tx_ameosformidable");
$this->oForm->init(
$this,
t3lib_extmgm::extPath($this->extKey) . "xml/form1.xml",
25 // uid of the record to edit ( if edition needed ;)
);
And then you have to get the generated HTML by calling the render() method of this object.
$sHtml = $this->oForm->render();
And you're done !
Quick FORMidable:XML syntax¶
A typical XML looks like this
<formidable version="0.6.0">
<meta>
<name>Create/edit an FE user</name>
<form formid="myuserform"/>
<debug>true</debug>
<displaylabels>true</displaylabels>
</meta>
<control>
<datahandler:DB>
<tablename>fe_users</tablename>
<keyname>uid</keyname>
</datahandler:DB>
<renderer:STANDARD/>
</control>
<elements>
<renderlet:TEXT name="username" label="User name"/>
<renderlet:PASSWORD name="password" label="Password"/>
<renderlet:SUBMIT label="Submit"/>
</elements>
</formidable>
There are always 3 main sections in the XML ( 4 with the root ) ; Each one of these 3 sections is required.
meta : global informations about the whole applications
control : holds the configuration for the datahandler (required), renderer (required) and actionlets (optional)
elements : section containing the renderlets
Each tag defining any renderlet / validator / renderer / datahandler / actionlet has to be declared as a part of the corresponding namespace ( renderlet:LISTBOX ; datahandler:DB ; renderer:TEMPLATE ; ... ). The second part of those tags, after the colon, defines the type of this tag, inside the namespace.
Each tag must be defined in lowercase, except for types of objects inside namespaces ( renderlet: LISTBOX , datahandler: RAW , ... ).
What is called a boolean in the following XML REF is a string “ true ” or “ false ”, lowercased.
What is called userobj is a tag that defines either:
- a callback to a PHP function inside an object
- a section on PHP code to execute inside a CDATA tag, returning something or not
- a section of TypoScript inside a CDATA tag.
Userobj are optional in most of the cases ; they give the ability to the developper to feed it's application with dynamically generated values rather than static XML ones.
XML REF¶
Renderlets¶
renderlet:*¶
This conf applies to all renderlets. Some renderlets might redefine default values for these properties, though.
/name¶
Property
/name
Data type
string
[a-zA-Z0-9_-]
Description
Name and id of the field in the form.
Name of the corresponding column in the database, also.
If none given, an anonymous name will be automatically generated.
You have to give a name if you want to be able to place the HTML produced by this renderlet into an HTML template ( if you don't know the name, you can't use its tag in the template )
Default
random anonymous
Advice
Always give a name unless YNWYD.
/label¶
Property
/label
Data type
string,
<userobj>
Description
Label of the field which will be displayed in your application
You can give here also a locallang formated string for localization, like LLL:EXT :........
See <control>/displaylabels
Default
empty string
Advice
Always try to use LLL:EXT localized strings
/readonly¶
Property
/readonly
Data type
boolean,
<userobj>
Description
Whether or not to allow modifications on this field.
If true, default behavior is to display the human-readable value of this renderlet.
Default
false
Advice
/renderonly¶
Property
/renderonly
Data type
boolean,
<userobj>
Description
Whether or not to consider data produced by this formfield in the datahandler.
More specifically, means should FORMidable insert / update this field in the DB if used with datahandler:DB, or filter results on this column/value when used for searching records with the datahandler:LISTER.
Default
false
Advice
Useful when the renderlet value is not meant to be inserted in the database, for instance a formfield used only to build the interface.
/type¶
Property
/type
Data type
string
Description
This property is a system property. It's automatically set to the type of the renderlet declared in the <renderlet:XYZ> tag, where here type would be set to XYZ.
You don't have to declare it, but if you need to, you can modify it at runtime using modifiers.
See modifiers, xml pre-compilation.
Default
renderlet type inside the namespace,
lowercased
Advice
/custom¶
Property
/custom
Data type
string,
<userobj>
Description
This property is a placeholder where you can place anything you want to be inserted in the HTML of the renderlet.
Typically, this will be inserted in the HTML tag of the renderlet;
for instance,
<custom>class=”red”</custom>will be, for a renderlet:TEXT HTML, used like this:
<input type='text” class=”red” ....>
Default
empty string
Advice
/wrap¶
Property
/wrap
Data type
string,
<userobj>
Description
Works like the typoscript .wrap property.
You can append parts of HTML before and after the render of your renderlet using this wrap.
Default
|
Advice
If used with renderer:TEMPLATE, you can use template tags inside the wrap if needed :)
/process¶
Property
/process
Data type
boolean,
<userobj>
Description
This boolean will give you the possibility to tell FORMidable not to evaluate this renderlet at runtime , meaning that you will be able to use complex tests to determine if the application should or not consider this field.
Default
true
Advice
Useful when you can't use modifiers because needed informations about whether or not to use this renderlet are not available at pre- compilation time
/recombine¶
Property
/recombine
Data type
<userobj> TS
Description
This tag allows user to give a TS template that will be used to generate the graphical layout of this renderlet.
The TS template can use an automatically generated params property that will holds all the distinct HTML parts of this renderlet
<recombine>
<userobj>
<ts><![CDATA[
10 = COA
10 {
5 = TEXT
5.value < params.label
5.wrap = <div>|</div>
10 = TEXT
10.value < params.input
10.wrap = <div class='myclass'>|</div>
}
]]></ts>
</userobj>
</recombine>
See multichannel-template for more informations about what's available in the params property.
Default
empty
Advice
REALLY powerful if you need tailor-made graph layout for your application.
/activelistable¶
Property
/activelistable
Data type
boolean,
<userobj>
Description
If true and if used with datahandler:LISTER, the renderlet will be displayed as a fully functional form field in the list.
If false and used with datahandler:LISTER, the renderlet will be displayed as a human-readable readonly value in the list.
Default
false
Advice
Set to true on renderlet LINK, BUTTON, ... if you want them to be displayed as active links or button in your list ;
/data¶
Property
/data
Data type
XML subconf
Description
This tag is the placeholder of all configuration that deals with available data, defaultvalue of the renderlet, available items for listboxes, checkboxes groups, ...
Default
empty
Advice
/ data /defaultvalue¶
Property
/ data /defaultvalue
Data type
string,
<userobj>
Description
Defines the default value for this renderlet.
If set, it will be used only when the form has not been already submitted ( first display ) and when in creation mode ( not edition mode )
See value / default value management
Default
empty
Advice
/ data /value¶
Property
/ data /value
Data type
string,
<userobj>
Description
Defines the value for this renderlet.
If set, the renderlet will allways use what's returned by /data/value as a value, no matter what the user give in the form field
Default
empty
Advice
/ data /items¶
Property
/ data /items
Data type
XML subconf
Description
Placeholder for the collection of items that will be used by the renderlet.
Items are typically the items of a listbox, radiobuttons group or checkboxes group.
You can dynamically give an array of items to the renderlet using a <userobj> tag defined at / data/userobj . If userobjed, returned value must be an array structured like:
Array(
Array(“caption” => “Item 1”, “value” => “1”),
Array(“caption” => “Item 2”, “value” => “2”),
Array(“caption” => “Item 3”, “value” => “3”),
)
See /data/items/item
Default
empty
Advice
Makes sense only when the renderlet has to deal with a collection of items
/ data/items /item¶
Property
/ data/items /item
Data type
XML subconf
Description
Placeholder for an item in the collection
See /data/items/item/caption and /data/items/item/value
Default
Advice
/ data/items/item /value¶
Property
/ data/items/item /value
Data type
string,
<userobj>
Description
Defines the value of this item.
Default
empty string
Advice
/search¶
Property
/search
Data type
XML subconf
Description
Useful only when used with datahandler:LISTER
Placeholder for configuring a specific way for the LISTER to search inside the database for this value.
Default search is:
if value not empty: rdt_name LIKE '%rdt_value%'
Default
empty
Advice
/ search /overridesql¶
Property
/ search /overridesql
Data type
string,
<userobj>
Description
Redefines the portion of SQL given by this renderlet to the datahandler:LISTER to override the default LIKE search
Example:
You would like the search results to be filtered on some criteria if our checkbox renderlet is checked in the searchform ; do something like this:
<renderlet:CHECKSINGLE
name="xmasspecific"
label="Display only Xmas specific items">
<onclick submit="true"/>
<search>
<overridesql>
<userobj>
<php><![CDATA[
return "(xmasflag=1 OR (santaflag=1 AND eventdate='" . strftime("%Y") . "-12-25'))";
]]></php>
</userobj>
</overridesql>
</search>
</renderlet:CHECKSINGLE>
empty
/ search /mode¶
Property
/ search /mode
Data type
string
Description
One of startswith , googlelike
startswith : search only records within this column starting with value
googlelike : search words like value records with AND logic and full string if surrounded by quotes “
Default
empty
Advice
Use the renderlet:CHOOSER with this to have a nice alphabetical-hash selector
/ search /onfields¶
Property
/ search /onfields
Data type
string
Description
Comma-separated list of columns to search on in the database
Default
empty
Advice
/onclick,¶
Property
/onclick,
/onmouseover,
/on...
Data type
string,
<userobj>
Description
Client & Server Events handling.
See section “Events” for more informations
Default
empty
Advice
/validators¶
Property
/validators
Data type
XML subconf
Description
Placeholder for the collection of validators for this renderlet.
See the section Validators for more informations
Default
Advice
Examples:¶
Note: screenshots of these examples are made using renderer:STANDARD
Renderlet:TEXT¶
Plain renderlet:
<renderlet:TEXT>
<name>favcolor</name>
<label>Favourite color</label>
</renderlet:TEXT>
Which is equivalent to (always prefer this one ;) :
<renderlet:TEXT name="favcolor" label="Favourite color"/>
This renders as:
Renderlet with defaultvalue :
<renderlet:TEXT name="favcolor" label="Favourite color">
<data defaultvalue="red"/>
</renderlet:TEXT>
Renders as:
Renderlet with defaultvalue, custom & wrap:
<renderlet:TEXT name="favcolor" label="Favourite color">
<custom>style=”background-color: yellow; border: 4px orange dashed;”</custom>
<data defaultvalue="red"/>
<wrap><![CDATA[
<div style="background-color: pink;">This will be place before my textbox</div>
<div style="margin: 10px; background-color: cornflowerblue">|</div>
<div style="background-color: tomato;">And this, after. Thank you Mr. Wrap !</div>
]]></wrap>
</renderlet:TEXT>
Renders as:
Using userobj for defaultvalue and label:
<renderlet:TEXT name="favcolor">
<label>
<userobj>
<php><![CDATA[
$sTime = strftime("%H:%M:%S");
return "It's " . $sTime . " already ! Time to tell us your favorite color!";
]]></php>
</userobj>
</label>
<custom>style=”background-color: yellow; border: 4px orange dashed”</custom>
<data>
<defaultvalue>
<userobj>
<php><![CDATA[
$aColors = array(
"red",
"blue",
"green",
"purple",
);
return $aColors[rand(0, (sizeOf($aColors) - 1))];
]]></php>
</userobj>
</defaultvalue>
</data>
<wrap><![CDATA[
<div style="background-color: pink;">This will be place before my textbox</div>
<div style="margin: 10px; background-color: cornflowerblue">|</div>
<div style="background-color: tomato;">And this, after. Thank you Mr. Wrap !</div>
]]></wrap>
</renderlet:TEXT>
Renders as:
Using recombine:
Note: Recombine unactivates the wrap ; so we dont use wrap here, only TS template
We give here only the <recombine> tag for this example. To get the full example XML for this renderlet, replace the <wrap> tag in the previous example with this <recombine> tag.
<recombine>
<userobj>
<ts><![CDATA[
10 = COA
10 {
10 = TEXT
10.value < params.input
10.wrap (
This is processed by a Typoscript template :)<br />
<div style="background-color: red;">|</div>
)
20 = TEXT
20.value < params.label
20.wrap (
<div>
The label of this renderlet is: <b style="background-color: black; color: white;">|</b>
<br />
<div>Can you figure out the possibilities ?</div>
</div>
)
30 = TEXT
30.value < params.help
30.wrap (
<div style="background-color: silver;">
This is an array of the available HTML-channels properties for a TEXT renderlet.<br />
|
<i>See Documentation at <b>Multichannel Templates</b> for more informations</i>
</div>
)
}
10.wrap (
<div style="background-color: pink; padding: 10px;">
Everything inside this pink box is the render of the renderlet:TEXT<br />
|
</div>
)
]]></ts>
</userobj>
</recombine>
Renders as:
renderlet:TEXT¶
No special conf. See renderlet:*
renderlet:DATE¶
All configuration specific to this renderlet is found in / data/datetime/
This renderlet is designed to handle timestamps. It takes timestamp as an input, and returns timestamp as a value, plus human readable date as an HTML output.
/ data / datetime /format¶
Property
/ data / datetime /format
Data type
strftime() string
Description
Strftime like string used to customize the display of the date.
See http://www.php.net/strftime
Default
required
Advice
/data/datetime/ locale¶
Property
/data/datetime/ locale
Data type
LOCALE string
Description
Locale code string to localize the date display
See http://www.php.net/setlocale
Default
system LOCALE
Advice
/data/datetime /displaytime/¶
Property
/data/datetime /displaytime/
Data type
boolean
Description
Whether or not to display the time selector in the js-calendar.
Default
false
Advice
Examples:¶
Plain renderlet:DATE
XML:
<renderlet:DATE name="birthdate" label="Birth date">
<data>
<datetime format="%m/%d/%Y"/>
</data>
</renderlet:DATE>
Renders as:
Renderlet:DATE with time selector, userobj'd defaultvalue and custom property
XML:
<renderlet:DATE name="birthdate" label="Birth date">
<custom>style='width: 200px;'</custom>
<data>
<datetime format="The date is %m-%d-%Y %H:%M:%S" displaytime="true"/>
<defaultvalue>
<userobj>
<php><![CDATA[ return mktime(13, 45, 23, 1, 1, 1998); ]]></php>
</userobj>
</defaultvalue>
</data>
</renderlet:DATE>
Renders as:
renderlet:FILE¶
/ data /targetdir¶
Property
/ data /targetdir
Data type
string
Description
path to the directory where files will be uploaded,
relative to the root path of the site;
Typically: /typo3temp/tx_myext_pi1/
Default
required
Advice
Note: uploaded file will be stored in the /data/targetdir/ directory. If filename already exists, it will be automatically renamed, suffixed with _(number) (look at the examples)
Examples:¶
Plain renderlet:FILE
XML:
<renderlet:FILE name="photo" label="Upload your photo">
<data targetdir="/typo3temp"/>
</renderlet:FILE>
Renders as:
Here, this file has been uploaded 8 times in the same folder, so it was suffixed _7. The link points to the file.
renderlet:LISTBOX, CHECKBOX, RADIOBUTTON¶
Like CHECKBOX AND RADIOBUTTON, this renderlet uses a collection of items to do the job.
/ data /items¶
Property
/ data /items
Data type
XML subconf
Description
See renderlet:*/data/items
Default
required
Advice
See renderlet:*/data/items
renderlet:CHECKBOX returns a list of selected items values comma- separated as data.
Examples¶
Plain renderlet:LISTBOX
XML:
<renderlet:LISTBOX name="myexgirlfriends" label="My ex girlfriends">
<data>
<items>
<item caption="" value=""/>
<item caption="Laetitia" value="laetitia"/>
<item caption="Pamela" value="pamela"/>
<item caption="Juddy" value="juddy"/>
</items>
</data>
</renderlet:LISTBOX>
Renders as:
renderlet:LISTBOX using defaultvalue and userobj'd list of items
XML:
<renderlet:LISTBOX name="myexgirlfriends" label="My ex girlfriends">
<data defaultvalue="juddy">
<items>
<item caption="" value=""/>
<item caption="Laetitia" value="laetitia"/>
<item caption="Pamela" value="pamela"/>
<item caption="Juddy" value="juddy"/>
</items>
<userobj>
<php><![CDATA[
$aPre = array("Ash", "Ma", "Mela", "So", "Mama", "Juli");
$aPost = array("ley", "donna", "nie", "fia", "mia", "anna");
$aItems = array();
for($k = 0; $k < 5; $k++) {
$sPre = $aPre[rand(0, sizeOf($aPre) - 1)];
$sPost = $aPost[rand(0, sizeOf($aPost) - 1)];
$aItems[] = array(
"caption" => $sPre . $sPost,
"value" => strtolower($sPre . $sPost),
);
}
return $aItems;
]]></php>
</userobj>
</data>
</renderlet:LISTBOX>
Renders as:
renderlet:RADIOBUTTON¶
See renderlet:LISTBOX.
renderlet:CHECKBOX¶
See renderlet:LISTBOX
renderlet:CHECKBOX acts as a group of checkboxes. If you want a single checkbox, see renderlet:CHECKSINGLE.
renderlet:CHECKBOX can handle a list of multiple selected values, comma-separated.
Examples¶
Same example as for renderlet:LISTBOX, except that now defaultvalue points to several items.
XML:
<renderlet:CHECKBOX name="myexgirlfriends" label="My ex girlfriends">
<data defaultvalue="juddy,pamela">
<items>
<item caption="Laetitia" value="laetitia"/>
<item caption="Pamela" value="pamela"/>
<item caption="Juddy" value="juddy"/>
</items>
<userobj>
<php><![CDATA[
$aPre = array("Ash", "Ma", "Mela", "So", "Mama", "Juli");
$aPost = array("ley", "donna", "nie", "fia", "mia", "anna");
$aItems = array();
for($k = 0; $k < 5; $k++) {
$sPre = $aPre[rand(0, sizeOf($aPre) - 1)];
$sPost = $aPost[rand(0, sizeOf($aPost) - 1)];
$aItems[] = array(
"caption" => $sPre . $sPost,
"value" => strtolower($sPre . $sPost),
);
}
return $aItems;
]]></php>
</userobj>
</data>
</renderlet:CHECKBOX>
Renders as:
renderlet:CHECKSINGLE¶
No special conf. See renderlet:*
renderlet:CHECKSINGLE automatically returns 1 if the checkbox is checked, 0 if not.
renderlet:CHOOSER¶
Renders as a list of push-button links. Selected value is returned by the renderlet. Submits automatically on change event.
/wrapitem¶
Property
/wrapitem
Data type
wrap string
Description
Wrap property for items ( except selected item when / wrapselected given )
Default
|
Advice
/wrapselected¶
Property
/wrapselected
Data type
wrao string
Description
Wrap property for selected item
Default
/ wrapitem
Advice
/separator¶
Property
/separator
Data type
string
Description
String used for separating each items of the list
Default
| ( equals to pipe )
Advice
Examples¶
Plain renderlet:chooser
XML:
<renderlet:CHOOSER name="nbres">
<data defaultvalue="50">
<items>
<item caption="15" value="15"/>
<item caption="50" value="50"/>
<item caption="100" value="100"/>
</items>
</data>
<wrap><![CDATA[display: | per page]]></wrap>
<wrapselected><![CDATA[<span style='font-size: 20px;'>|</span>]]></wrapselected>
<wrapitem><![CDATA[<span>|</span>]]></wrapitem>
<separator><![CDATA[ - ]]></separator>
</renderlet:CHOOSER>
Renders as:
renderlet:LINK¶
Displays as a link. Can also return URL only.Useful for creating links with events handling. ( See events section ).NOTE: for being displayed in a list managed by datahandler:LISTER, has to be set as /activelistable (= true).
See renderlet:*/activelistable for more informations.
/url¶
Property
/url
Data type
string,
<userobj>
Description
Url to be used in the link.
If not given,and if the renderlet value ( see /data/defaultvalue & /data/value ) is an URL, then the renderlet value will be used for / url
Default
Advice
/urlonly¶
Property
/urlonly
Data type
boolean,
<userobj>
Description
Whether or not to return only the URL
Default
false
Advice
/label¶
Property
/label
Data type
string,
<userobj>
Description
If given, will be used as the caption of the link.
If not, value will be used.
Default
empty
Advice
/custom¶
Property
/custom
Data type
string,
<userobj>
Description
Use /custom to insert target if you need to
Default
empty
Advice
/readonly¶
Property
/readonly
Data type
boolean
Description
A renderlet:LINK is always readonly
Default
true (cannot be changed)
Advice
/renderonly¶
Property
/renderonly
Data type
boolean
Description
As its value can't change, a renderlet:LINK cannot be saved in database.
It can hold a value but only for programming commodities.
Default
true (cannot be changed)
Advice
Examples¶
Plain renderlet:LINK
XML:
<renderlet:LINK name="mylink" label="Go to my website" url="http://www.ameos.com/"/>
Renders as:
Renderlet link with userobj and no label
XML:
<renderlet:LINK name="mylink">
<url>
<userobj>
<php><![CDATA[
return t3lib_div::locationHeaderUrl(
$this->_oParent->pi_getPageLink(
$GLOBALS["TSFE"]->id,
"",
array(
"someparameter" => 1
)
)
);
]]></php>
</userobj>
</url>
</renderlet:LINK>
Notes: in a PHP <userobj>, $this always points to the FORMidable object, and $this->_oParent always points to the plugin calling FORMidable. See FORMidable CORE programming for more informations.
Renders as:
renderlet:BUTTON¶
A button useful for handling events. See events section for more information.
/renderonly¶
Property
/renderonly
Data type
boolean
Description
Always true
Default
true
Advice
/readonly¶
Property
/readonly
Data type
boolean
Description
Always true
Default
true
Advice
/activelistable¶
Property
/activelistable
Data type
boolean,
<userobj>
Description
Redefines default value as true ( different of renderlet:* )
Default
true
Advice
We want a button to be listable by default
renderlet:IMAGE¶
Used for displaying image in your application. What else ? ;)
/path¶
Property
/path
Data type
string,
<userobj>
Description
Path to the image; relative to path site; without starting slash
Or an evaluated path like EXT:my_ext/images/image.gif
Default
required
Advice
/imageconf¶
Property
/imageconf
Data type
TS <userobj>
Description
Typoscript used to reprocess image before displaying.
See examples.
Some effects are available in FORMidable base pack.
They are defined in EXT:ameos_formidable/ext_typoscript_setup.txt
Default
empty
Advice
Examples:¶
Plain renderlet:IMAGE
XML:
<renderlet:IMAGE>
<path>EXT:ameos_testform/res/atari.jpg</path>
</renderlet:IMAGE>
Renders as:
renderlet:IMAGE with imageconf (basepack's shaded effect) and width 100px max
XML:
<renderlet:IMAGE>
<path>EXT:ameos_testform/res/atari.jpg</path>
<imageconf>
<userobj>
<ts><![CDATA[
10 < config.tx_ameosformidable.res.shared.xml.imageprocess.shaded
10.file.50.file < params.relwebpath
10.file.50.file.width = 100m
]]></ts>
</userobj>
</imageconf>
</renderlet:IMAGE>
Renders as:
renderlet:IMAGE with imageconf (basepack's rounded effect) and width 100px max
XML:
<renderlet:IMAGE>
<path>EXT:ameos_testform/res/atari.jpg</path>
<imageconf>
<userobj>
<ts><![CDATA[
10 < config.tx_ameosformidable.res.shared.xml.imageprocess.rounded
10.file.10.file < params.relwebpath
10.file.10.file.width = 100m
]]></ts>
</userobj>
</imageconf>
</renderlet:IMAGE>
Renders as:
Validators¶
A validator is an object that will check the validity of a data produced by a renderlet against specified criteria.
They are declared inside a renderlet configuration, in an xml tag named <validators> , which is a placeholder for one or several <validator> .
Each validator has a type declared inside the validator namespace.
Ex: validator:DB , a validator of type DB that checks conditions inside database ; validator:NUM , checking numerical constraints on data; ...
A validator returns TRUE if data is OK, FALSE in the other case.
NOTE: Each validator returns TRUE if the data is empty, except the validator:STANDARD/required , returning FALSE if the data is empty. This allows to reject data only if given.
If validator returns FALSE, it also produce an error message corresponding to what's given in subsection <message> of the validator. You can use plain messages or localized LLL:EXT: ... locallang strings if needed.
Example:
Note: screenshots of these examples are made using renderer:STANDARD
<renderlet:TEXT name="email" label="Your email address">
<validators>
<validator:STANDARD>
<required message="Email address is required"/>
<email message="Email address not valid"/>
</validator:STANDARD>
<validator:DB>
<unique message="This email is already used in database"/>
</validator:DB>
</validators>
</renderlet:TEXT>
In this example, user has to enter it's email address; FORMidable will check if email is given, then if valid, then if not already in database for unicity.
Renders:
After submitting:
Let's give some weird data:
The datahandler will not process data until everything is valid in the form.
Displaying errors like this is the way renderer:STANDARD does by default. To have nicer, customized error messages, use renderer:TEMPLATE ( see renderer:TEMPLATE ;).
validator:STANDARD¶
This validator does the usual data-checks.
/required¶
Property
/required
Data type
Description
Checks that data is not empty
Default
empty
Advice
/authentified¶
Property
/authentified
Data type
Description
Checks that fe-user is authentified
Default
empty
Advice
/maxsize/value¶
Property
/maxsize/value
Data type
integer
Description
Checks that data length is < to value
For text-like renderlets, checks the char length.
For listbox/checkbox/radiobutton fields, checks the number of checked items.
Default
empty
Advice
/sameas/value¶
Property
/sameas/value
Data type
string
Description
Value has to be the name of an other renderlet.
Checks that the value for this renderlet is the same that the value for the given renderlet.
Default
empty
Advice
Useful when checking password confirmation
/email¶
Property
Data type
Description
Checks that data is a valid email address
Default
Advice
/userobj¶
Property
/userobj
Data type
<userobj>
Description
Executes the userobj for checking data.
If you can't do it using hardcoded valitadors, use this validator.
The userobj has to return TRUE if valid, FALSE if not.
See example below
Default
Advice
Examples¶
validator:STANDARD/userobj
This example demonstrates how to perform custom validation on data:
XML:
<renderlet:TEXT name="email" label="Your email adress">
<validators>
<validator:STANDARD>
<userobj message="Sorry, we don't want hotmailers here">
<php><![CDATA[
$sValue = array_pop(func_get_args());
if(!empty($sValue)) {
if(strstr(strtolower($sValue), "@hotmail.com")) {
return FALSE;
}
}
return TRUE;
]]></php>
</userobj>
</validator:STANDARD>
</validators>
</renderlet:TEXT>
Renders as:
validator:DB¶
Checks DB related conditions.
To be used only with datahandler:DB
/unique¶
Property
/unique
Data type
Description
Checks that data is unique inside the table for this column.
Default
empty
Advice
validator:FILE¶
Checks FILE related conditions.
Useful for checking file after upload.
NOTE: WARNING: if file is rejected by any of validator:FILE, it will be deleted by FORMidable.
USE only for user-uploaded files. Not meant to test files existing on the server. They would be deleted.
/extension/value¶
Property
/extension/value
Data type
string csv
Description
Checks that file extension matches one of the list.
Takes comma-separated list of file extensions to be matched.
Default
empty
Advice
/filesize/value¶
Property
/filesize/value
Data type
integer
Description
Checks that filesize is below or equal to given filesize.
Filesize in Bytes.
Default
empty
Advice
validator:NUM¶
Checks numeric related conditions.
/islower/value¶
Property
/islower/value
Data type
integer
Description
Checks that data is a number lower than given number.
Default
empty
Advice
/ishigher/value¶
Property
/ishigher/value
Data type
integer
Description
Checks that data is a number higher than given number.
Default
empty
Advice
/isbetween/value¶
Property
/isbetween/value
Data type
string csv
Description
Checks that data is a number between given lower and upper bound, comma-separated.
Default
Advice
validator:PREG¶
Checks validity of data against regex pattern. (See http://www.php.net/regex ).
Credit for this validator goes to Jérémy Lecour ( jeremy.lecour(a)nurungrandsud(dt)com )
/pattern/value¶
Property
/pattern/value
Data type
string regex
Description
Checks data validity against regex.
If pattern prefixed with !, then condition is reversed.
Default
empty
Advice
Control¶
The <control> section of the XML is just a placeholder for the datahandler , the renderer and optionally actionlets .
See datahandler , renderer and actionlets .
Datahandlers¶
Datahandler's job is to do something with the data produced by your application. Quite cool, huh ?
datahandler will be executed only when form is submitted and all validators are GO.
There are several datahandlers available.
datahandler:DB¶
This is the most used datahandler. Designed to insert / update records into the given table.
This datahandler works by default in CREATION mode. This means that it will insert form-data into the given table.
To make it work in EDITION mode, when instanciating FORMidable, give the uid of the record you need to edit as a parameter.
Like this:
$this->oForm = t3lib_div::makeInstance("tx_ameosformidable");
$this->oForm->init(
$this,
t3lib_extmgm::extPath($this->extKey) . "xml/form.xml",
25 // uid of the record to edit
);
(See Integration of FORMidable in my plugin for more informations about this)
/tablename¶
Property
/tablename
Data type
string
Description
Name of the DB table to work on.
Default
required
Advice
/keyname¶
Property
/keyname
Data type
string
Description
Name of the primary key in the given table.
Default
required
Advice
/process/beforeinsertion¶
Property
/process/beforeinsertion
Data type
<userobj>
Description
Define a userobj here if you want to alter the data that are to be inserted / updated into the database.
Takes an array of values as an input, returns an array of values as an output.
See example below.
Default
empty
Advice
Useful when you want to add system fields to your table row, like pid, crdate , ...
If you want to cancel the modification of the data in DB, return an empty array() here
Examples¶
Simple datahandler:DB working on fe_users table
XML:
<datahandler:DB>
<tablename>fe_users</tablename>
<keyname>uid</keyname>
</datahandler:DB>
datahandler:DB working on fe_users tables, adding pid and crdate to the record using /process/beforeinsertion
XML:
<datahandler:DB>
<tablename>fe_users</tablename>
<keyname>uid</keyname>
<process>
<beforeinsertion>
<userobj>
<php><![CDATA[
$aData = array_pop(func_get_args());
$aData["pid"] = 343;
$aData["crdate"] = time();
return $aData;
]]></php>
</userobj>
</beforeinsertion>
</process>
</datahandler:DB>
datahandler:RAW¶
The job of datahandler:RAW is to give produced data to another data processor (typically a method of your plugin).
Useful if you want to use formidable as an interface manager, but still process data yourselves.
/callback¶
Property
/callback
Data type
<userobj>
Description
Userobj to be executed to process form-data.
Reminder: you can access to your plugin using:
$this->_oParent in the PHP code of the userobj
Default
required
Advice
datahandler:LISTER¶
The job of datahandler:LISTER is to display a list of records selected in a table AND (optionally) to apply search filters to this selection to turn your form into a searchform.
The idea is to use the form generated by FORMidable as a searchform. Of course the searchform is to be used only when needed, because you can also just list the data of a table without search.
/tablename¶
Property
/tablename
Data type
string
Description
The name of the table to work on
Default
required
Advice
/keyname¶
Property
/keyname
Data type
string
Description
Name of the primary key of this table
Default
required
Advice
/template¶
Property
/template
Data type
XML subconf
Description
Placeholder for the template configuration of the list
Default
empty
Advice
Optional; if none given, the LISTER will try to build a default template for displaying records
/template/ path¶
Property
/template/ path
Data type
string,
<userobj>
Description
The path to the HTML template file
Default
required
Advice
EXT:my_ext/template.html
/ template /subpart¶
Property
/ template /subpart
Data type
string,
<userobj>
Description
The subpart of this template to work on.
Default
required
Advice
Something like ###MY_LIST###
/ template /customtags¶
Property
/ template /customtags
Data type
XML subconf
Description
Placeholder for custom tags that will be added to each row of the list.
Collection of <tag>
Default
empty
Advice
/ template / customtags /tag¶
Property
/ template / customtags /tag
Data type
XML subconf
Description
An item that will describe something to add to each row of the list
Default
empty
Advice
/template/customtags/tag/ name¶
Property
/template/customtags/tag/ name
Data type
string
Description
Name of the tag that will be searched and substituted in every line of the list
Default
required
Advice
/template/customtags/tag/ value¶
Property
/template/customtags/tag/ value
Data type
string,
<userobj>
Description
The value that will be inserted in the template for each line. See example below
Default
required
Advice
/search¶
Property
/search
Data type
XML subconf
Description
Placeholder for configuring all the aspects of the search within records.
Default
empty
Advice
/ search /atstartup¶
Property
/ search /atstartup
Data type
boolean,
<userobj>
Description
Whether or not to display list at first display of the application. If false, list will be displayed only after first submit.
Default
true
Advice
/ search /keepinsession¶
Property
/ search /keepinsession
Data type
boolean,
<userobj>
Description
Whether or not to keep list of uids matching search criteria (if any) in session for further usage.
Default
false
Advice
See FORMidable CORE API programming
/ search/ sql¶
Property
/ search/ sql
Data type
XML subconf
Description
Placeholder for modifying / overriding the SQL query executed to fetch records.
Default
empty
Advice
/ search/sql /query¶
Property
/ search/sql /query
Data type
string,
<userobj>
Description
SQL query that will be used to fetch records from the database
Default
empty
Advice
Use it with a <userobj> to build custom query if needed
See FORMidable CORE API programming
/ search/sql /wheres¶
Property
/ search/sql /wheres
Data type
XML subconf
Description
Placeholder for defining SQL conditions that will be added to the one that FORMidable will automatically build for fetching records.
Default
empty
Advice
/ search/sql/wheres /beginbrace¶
Property
/ search/sql/wheres /beginbrace
Data type
XML tag
Description
Adds a “(“ to the SQL query.
Define it like this:
<beginbrace />
Default
empty
Advice
/ search/sql/wheres /beginbrace¶
Property
/ search/sql/wheres /beginbrace
Data type
XML tag
Description
Default
empty
Advice
/search/sql/wheres /endbrace¶
Property
/search/sql/wheres /endbrace
Data type
XML tag
Description
Adds a “)“ to the SQL query.
Define it like this:
<endbrace />
Default
empty
Advice
/ search/sql/wheres/ where¶
Property
/ search/sql/wheres/ where
Data type
XML subconf
Description
Default
empty
Advice
/ search/sql/wheres/where /term¶
Property
/ search/sql/wheres/where /term
Data type
string
Description
Column to apply the additional where
Default
required
Advice
/ search/sql/wheres/where /comparison¶
Property
/ search/sql/wheres/where /comparison
Data type
string
Description
Type of comparison that will be executed between this term and its value.
One of: IN , NOT IN , = , < , > , <= , >= , !=
Default
required
Advice
You don't need to care about quotes or braces here, FORMidable will automatically add what your conf needs to be SQL valid.
/ search/sql/wheres/where /value¶
Property
/ search/sql/wheres/where /value
Data type
string,
<userobj>
Description
The value this term will be compared to.
Default
required
Advice
/ search/sql/wheres/ logic¶
Property
/ search/sql/wheres/ logic
Data type
string
Description
One of: AND , OR
Default
Advice
/process¶
Property
/process
Data type
XML subconf
Description
Placeholder for data processing directives
Default
empty
Advice
/ process /beforesearch¶
Property
/ process /beforesearch
Data type
<userobj>
Description
Takes an array of values to search as an input, returns the modified array of values.
Default
empty
Advice
See datahandler:DB/process/beforeinsertion
/ process /duringlisterraw¶
Property
/ process /duringlisterraw
Data type
<userobj>
Description
Process raw database values for each row that are to be displayed in the list.
Takes an array of values to search as an input, returns the modified array of values.
Default
empty
Advice
See datahandler:DB/process/beforeinsertion
/ process /duringlister¶
Property
/ process /duringlister
Data type
<userobj>
Description
Process human readable values for each row that are to be displayed in the list.
Takes an array of values to search as an input, returns the modified array of values.
Default
empty
Advice
See datahandler:DB/process/beforeinsertion
/pager¶
Property
/pager
Data type
XML subconf
Description
Placeholder for all the configuration that deals with dispatching data across several pages.
Default
empty
Advice
/ pager /sort/¶
Property
/ pager /sort/
Data type
XML subconf
Description
Placeholder for sorting configuration
Default
empty
Advice
/ pager/sort /field¶
Property
/ pager/sort /field
Data type
string
Description
Default table column on which data will be sorted at first display.
Default
/keyname
Advice
/ pager/sort /dir¶
Property
/ pager/sort /dir
Data type
string
Description
Default direction on which data will be sorted at first display.
One of: ASC , DESC
Default
DESC
Advice
/pager /rows¶
Property
/pager /rows
Data type
XML subconf
Description
Placeholder for configuration
Default
empty
Advice
/ pager/rows /perpage¶
Property
/ pager/rows /perpage
Data type
number,
<userobj>
Description
Number of records to display per page
Default
5
Advice
/ pager/rows /maximum¶
Property
/ pager/rows /maximum
Data type
number,
<userobj>
Description
Maximum number of records to fetch
Default
empty
Advice
/ pager/rows /toomany¶
Property
/ pager/rows /toomany
Data type
string,
<userobj>
Description
String that will be displayed if the number of records fetch is greater than /pager/rows/maximum ( if defined ).
If this property is not defined, the LISTER will just limit it's display to the /pager/rows/maximum ( if defined ).
If used in a userobj, params are given telling how much records have been counted ( numrows ), and how many records can be handled at max( maximum ).
See getting parameter into userobj for more informations.
Default
empty
Advice
/ pager/rows /active¶
Property
/ pager/rows /active
Data type
string
Description
Subpart handler in the list template to be used for displaying active line ( if the LISTER is combined with another form using datahandler:DB for editing records found in the list ).
Something like ###ROWACT###
Default
empty
Advice
/ pager/rows /alternate¶
Property
/ pager/rows /alternate
Data type
string csv
Description
Comma-separated string of template subpart handlers to be used alternatively to display all the lines of the list.
Something like ###ROW1###,###ROW2###
Default
required if LISTER used with template
Advice
/ pager/rows /window¶
Property
/ pager/rows /window
Data type
number
Description
Number of pages to display in the pager for navigating thru pages
Default
Advice
/callback¶
Property
/callback
Data type
<userobj>
Description
<userobj> that will be called to give the produced list HTML to your plugin.
typically something like:
$aParams = array_pop(func_get_args());
$this->_oParent->sListHTML = $aParams["HTML"];
// $this->_oParent allways point to your plugin
// this way the HTML for the list is stored
// in a member var of your plugin for further usage
We do this because the main render() method of FORMidable that you call in your plugin returns only the HTML generated for the form;
NOTE: render() method returns the HTML if the renderer of this application did not returned anything, which is the case when you use renderer:VOID ; in that case ( when you don't want a searchform and the list, but just the list ) you don't have to provide this /callback as render() method will return the list HTML.
See renderer:VOID for more informations about how to do searchform- less lists.
See demo extensions for concrete examples of the LISTER
Renderers¶
Renderers are the glue that sticks all the HTML generated parts together. Let's snort some renderers.
renderer:VOID¶
The simplest renderer of all. It does nothing with the generated HTML.
Useful when you want to display a LIST using a lister without displaying any searchform.
No configuration for this one.
renderer:STANDARD¶
The renderer used at development time. It takes the HTML parts generated by renderlets and validators, and display them separated by line breaks wrapped in <p /> HTML tags.
No configuration.
renderer:TEMPLATE¶
The most powerful renderer available for FORMidable. Takes a template file as an input and inserts HTML parts by substituting stuff like {my_marker} with the corresponding HTML.
Tags are formatted like this: {my_renderlet_name}
Each renderlet renders it's full layout ; the produced HTML will be accessible using the syntax {my_renderlet_name} .
But there is more to a renderlet output than meets the eye. See Multichannel-template to have more information about this.
/template¶
Property
/template
Data type
XML subconf
Description
Placeholder for the template configuration of the list
Default
required
Advice
/template/ path¶
Property
/template/ path
Data type
string,
<userobj>
Description
The path to the HTML template file
Default
required
Advice
EXT:my_ext/template.html
/ template /subpart¶
Property
/ template /subpart
Data type
string,
<userobj>
Description
The subpart of this template to work on.
Default
required
Advice
Something like ###MY_FORM###
/ template /errortag¶
Property
/ template /errortag
Data type
string
Description
The tag that will be susbtituted to insert errors into template.
Something like this:
<errortag>myerrortag</errortag>
Note: FORMidable sets automatically a cssdisplay channel to this tag, which will contain block if there were errors in the data user gived, or none in the other case. Set to none at first display.This way you can display or not the container of the errors easily if needed, doing something like this:
<div style="display: {myerrortag.cssdisplay};">
<p>Some fields have not been correctly completed:</p>
<span style="color: red;">{errors}</span>
</div>
This way the div and it's content will be displayed only if there were errors.
See multichannel-template for more informations about this kind of feature.
Multichannel-template¶
Each renderlet renders it's full layout. It's available in the template using this marker syntax {my_renderlet_name} .
But each renderlet has also a lot of other informations to give about it's job than just the compiled HTML.
So Multichannel-template is a way to access these informations in your template using a simple dotted notation is your template marker.
Example: I would like to display the label of my renderlet in a red span after the field itselves
You would do something like this, in your HTML template:
{my_renderlet_name.input}<br />
<span style="color: red;">{my_renderlet_name.label}</span>
There are plenty of these HTML bonuses inside each one of the renderlets. To know exactly what's available on a renderlet, use the .help channel of this renderlet in your template.
Like this:
{my_renderlet_name.input}<br/>
<span style="color: red;">{my_renderlet_name.label}</span>
Available properties form my renderlet: {my_renderlet_name.help}
This way you can totally reshape the layout of a renderlet within your template.
See also /renderlet:*/recombine for a TS approach on using these channels.
Events / server events¶
Every renderlet in FORMidable implements an event-management layer.
It allows the user to interact with your FORMidable application far beyond the traditional uses of a form.
There are 2 types of events :
Javascript events ( client events )¶
These events are wrappers for the Javascript events of your web browser.
Available events are:
/onactivate¶
Property
/onactivate
Description
Fires when the object is set as the active element.
/onafterupdate¶
Property
/onafterupdate
Description
Fires on a databound object after successfully updating the associated data in the data source object.
/onbeforeactivate¶
Property
/onbeforeactivate
Description
Fires immediately before the object is set as the active element.
/onbeforecut¶
Property
/onbeforecut
Description
Fires on the source object before the selection is deleted from the document.
/onbeforedeactivate¶
Property
/onbeforedeactivate
Description
Fires before the activeElement is changed from the current object to another object in the parent document.
/onbeforeeditfocus¶
Property
/onbeforeeditfocus
Description
Fires before an object contained in an editable element enters a UI- activated state or when an editable container object is control selected.
/onbeforepaste¶
Property
/onbeforepaste
Description
Fires on the target object before the selection is pasted from the system clipboard to the document.
/onbeforeupdate¶
Property
/onbeforeupdate
Description
Fires on a databound object before updating the associated data in the data source object.
/onblur¶
Property
/onblur
Description
Fires when the object loses the input focus.
/onchange¶
Property
/onchange
Description
Fires when the contents of the object or selection have changed.
/onclick¶
Property
/onclick
Description
Fires when the user clicks the left mouse button on the object.
/oncontrolselect¶
Property
/oncontrolselect
Description
Fires when the user is about to make a control selection of the object.
/oncut¶
Property
/oncut
Description
Fires on the source element when the selection is removed from the document and added to the system clipboard.
/ondblclick¶
Property
/ondblclick
Description
Fires when the user double-clicks the object.
/ondeactivate¶
Property
/ondeactivate
Description
Fires when the activeElement is changed from the current object to another object in the parent document.
/ondrag¶
Property
/ondrag
Description
Fires on the source object continuously during a drag operation.
/ondragend¶
Property
/ondragend
Description
Fires on the source object when the user releases the mouse at the close of a drag operation.
/ondragenter¶
Property
/ondragenter
Description
Fires on the target element when the user drags the object to a valid drop target.
/ondragleave¶
Property
/ondragleave
Description
Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.
/ondragover¶
Property
/ondragover
Description
Fires on the target element continuously while the user drags the object over a valid drop target.
/ondragstart¶
Property
/ondragstart
Description
Fires on the source object when the user starts to drag a text selection or selected object.
/ondrop¶
Property
/ondrop
Description
Fires on the target object when the mouse button is released during a drag-and-drop operation.
/onerrorupdate¶
Property
/onerrorupdate
Description
Fires on a databound object when an error occurs while updating the associated data in the data source object.
/onfilterchange¶
Property
/onfilterchange
Description
Fires when a visual filter changes state or completes a transition.
/onfocus¶
Property
/onfocus
Description
Fires when the object receives focus.
/onfocusin¶
Property
/onfocusin
Description
Fires for an element just prior to setting focus on that element.
/onfocusout¶
Property
/onfocusout
Description
Fires for the current element with focus immediately after moving focus to another element.
/onhelp¶
Property
/onhelp
Description
Fires when the user presses the F1 key while the browser is the active window.
/onkeydown¶
Property
/onkeydown
Description
Fires when the user presses a key.
/onkeypress¶
Property
/onkeypress
Description
Fires when the user presses an alphanumeric key.
/onkeyup¶
Property
/onkeyup
Description
Fires when the user releases a key.
/onlosecapture¶
Property
/onlosecapture
Description
Fires when the object loses the mouse capture.
/onmousedown¶
Property
/onmousedown
Description
Fires when the user clicks the object with either mouse button.
/onmouseenter¶
Property
/onmouseenter
Description
Fires when the user moves the mouse pointer into the object.
/onmouseleave¶
Property
/onmouseleave
Description
Fires when the user moves the mouse pointer outside the boundaries of the object.
/onmousemove¶
Property
/onmousemove
Description
Fires when the user moves the mouse over the object.
/onmouseout¶
Property
/onmouseout
Description
Fires when the user moves the mouse pointer outside the boundaries of the object.
/onmouseover¶
Property
/onmouseover
Description
Fires when the user moves the mouse pointer into the object.
/onmouseup¶
Property
/onmouseup
Description
Fires when the user releases a mouse button while the mouse is over the object.
/onmousewheel¶
Property
/onmousewheel
Description
Fires when the wheel button is rotated.
/onmove¶
Property
/onmove
Description
Fires when the object moves.
/onmoveend¶
Property
/onmoveend
Description
Fires when the object stops moving.
/onmovestart¶
Property
/onmovestart
Description
Fires when the object starts to move.
/onpaste¶
Property
/onpaste
Description
Fires on the target object when the user pastes data from the system clipboard to the document.
/onpropertychange¶
Property
/onpropertychange
Description
Fires when a property changes on the object.
/onreadystatechange¶
Property
/onreadystatechange
Description
Fires when the state of the object has changed.
/onresize¶
Property
/onresize
Description
Fires when the size of the object is about to change.
/onresizeend¶
Property
/onresizeend
Description
Fires when the user finishes changing the dimensions of the object in a control selection.
/onresizestart¶
Property
/onresizestart
Description
Fires when the user begins to change the dimensions of the object in a control selection.
/onselect¶
Property
/onselect
Description
Fires when the current selection changes.
/onselectstart¶
Property
/onselectstart
Description
Fires when the object is being selected.
/ontimeerror¶
Property
/ontimeerror
Description
Fires whenever a time-specific error occurs, usually as a result of setting a property to an invalid value.
Examples:¶
renderlet:TEXT with onfocus and onblur events
<renderlet:TEXT onfocus="alert('You are in');" onblur='alert(“You are out”);'/>
renderlet:TEXT with multiline onfocus event
<renderlet:TEXT name="mytextfield">
<data defaultvalue="Your name here"/>
<onfocus><![CDATA[
var oTxt = $("testform[mytextfield]");
oTxt.value = "";
]]></onfocus>
</renderlet:TEXT>
renderlet:BUTTON with userobj'd onclick event
<renderlet:BUTTON label=”What time is it ?”>
<onclick>
<userobj>
<php><![CDATA[
return "alert('it is " . strftime("%H:%M:%S") . " at php time !')";
]]></php>
</userobj>
</onclick>
</renderlet:TEXT>
PHP events (server events)¶
A server event is a section of PHP code that will be executed only if the user triggers the corresponding event on the renderlet. There is a listener of server event for each properties of the event list of section Javascript events .
Examples¶
renderlet:BUTTON with onclick server event
<renderlet:BUTTON label=”Press here to send me an email”>
<onclick runat=”server”>
<userobj>
<php><![CDATA[
$to = 'typo3dev@ameos.com';
$subject = 'FORMidable::server event';
$message = 'Hey, this works nice !';
$headers = 'From: formidable@ameos.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
]]></php>
</userobj>
</onclick>
</renderlet:TEXT>
When pressed, the web page refreshes and executes the userobj attached to the triggered event.