Skip to content
Anibal Sanchez edited this page Sep 13, 2016 · 2 revisions

Text Field

This will display a single line text input.

You can set the following attributes:

  • url URL template for each element (use [ITEM:ID] as a placeholder for the item id). This goes through the field tag replacement (see XML Form Fields)

  • show_link If true, a link will be appended around the field value (default false)

  • empty_replacement a string to show in place of the field when it's empty

  • size The size of the input in characters

  • maxlength The maximum acceptable input length in characters

  • readonly Is this a read-only field?

  • disabled Is this a disabled form field element?

  • format A string or translation key used to format the text data before it is displayed. Uses the format() PHP function's syntax.

  • format_if_not_empty Should we apply the format string even when the field is empty? Default: true

  • parse_value If set to true, the value of the field will go through the field tag replacement (see below) Default: false

  • format_source_file, format_source_class and format_source_method Class definition to format the text data before it is displayed.

Field tag replacement for text fields

You can reference values from other fields inside your text. See XML Form Fields.

FOF also recognises the special tag [ITEM:ID], replacing it with the value of the key field of the table.

Other model fields can be accessed with the notation [ITEM:FIELDNAME] where FIELDNAME is the name of your field in all uppercase. For example, if your item has a field called foo_bar you can get its value using the special tag [ITEM:FOO_BAR]. Do keep in mind that the field name MUST be in uppercase. This means that [ITEM:foo_bar] and [ITEM:Foo_Bar] will NOT work.

Moreover, you can use the special tag [TOKEN] to add the form token. Typically this is added as &[TOKEN]=1 at the end of the URL.

Remember that the url attribute is used in an XML file. As such, you can't use an ampersand (&) directly in the URL. You need to type it as the HTML entity &. If you forget that then your XML will be invalid and FOF won't be able to load your form.

Sample URL definition: url="index.php?option=com_example&view=Foo&id=[ITEM:ID]&something=[ITEM:SOMETHING]&[TOKEN]=1"

Clone this wiki locally