Prefill or preselect a field

The standard way

Prefilling (input, textarea, hidden) or preselecting (select, check, radio) of fields will be done by the PrefillFieldViewHelper. It listen to the following methods and parameters (in this ordering):

  1. GET/POST param like &tx_powermail_pi1[field][marker]=value
  2. GET/POST param like &tx_powermail_pi1[marker]=value
  3. If field should be filled with values from FE_User (see field configuration)
  4. If field should be prefilled from static Setting (see field configuration)
  5. Fill with TypoScript cObject like
plugin.tx_powermail.settings.setup.prefill {
        # Fill field with marker {email}
        email = TEXT
        email.value =
  1. Fill with simple TypoScript like
plugin.tx_powermail.settings.setup.prefill {
        # Fill field with marker {email}
        email =
  1. Fill with your own PHP with a Signal. Look at In2codePowermailViewHelpersMiscPrefillFieldViewHelper::render()

Example markup


Generating select options out of TypoScript

You can dynamicly generate a select (or radio-buttons or checkboxes) field in powermail with some lines of TypoScript. To use this feature, you have to leave the field “Options” empty and you should fill the field “Create from TypoScript” with a TypoScriptObjectPath. See the following example:



Example 1

After this, you can define your TypoScript setup:

lib.options = TEXT
lib.options.value = red[\n]blue[\n]pink

This will result in a HTML like:

<select ...>

Example 2

You can also define it with different labels and values:

lib.options = TEXT
lib.options.value = Red shoes|red[\n]Blue shoes|blue|*[\n]Pink shoes|pink

This will result in a HTML like:

<select ...>
        <option value="red">Red shoes</option>
        <option value="blue" selected="selected">Blue shoes</option>
        <option value="pink">Pink shoes</option>

Example 3

Or maybe the visitor should select a category from table sys_category:

lib.options = CONTENT
lib.options {
        table = sys_category
        select.pidInList = 156
        renderObj = COA
        renderObj {
                10 = TEXT
                10.field = title

                20 = TEXT
                20.value = |

                30 = TEXT
                30.field = uid

                stdWrap.wrap = |[\n]

This will result in a HTML like:

<select ...>
        <option value="23">Category 1</option>
        <option value="24">Category 1</option>
        <option value="25">Category 1</option>