tce_functions_form.php

Functions to handle XHTML Form Fields.

Source: shared/code/tce_functions_form.php

Functions to handle XHTML Form Fields.

Constants

K_EMAIL_RE_PATTERN

const K_EMAIL_RE_PATTERN = '^([a-zA-Z0-9_\.\-\+\%]+)@([a-zA-Z0-9\.\-]+)$'

Source: shared/code/tce_functions_form.php:60

Functions

F_check_fields_format()

Check fields format against the server-side canonical pattern registry.<br> Returns a string containing a list of wrong fields (comma separated).

For every field present in F_get_field_format_registry() that was submitted with a non-empty value, the value is matched against its canonical (server-authored) pattern. The client-supplied ‘x_<field>’ value is ignored entirely, so a tampered/omitted/malicious pattern can neither bypass validation nor be executed as a regular expression.

function F_check_fields_format(mixed $formfields): string

Parameters:

  • $formfields (mixed): (array) input array containing form fields

Returns: string: comma-separated list of wrong fields (empty when all valid)

Source: shared/code/tce_functions_form.php:169

F_check_form_fields()

Check Form Fields.

see: F_check_required_fields, F_check_fields_format

function F_check_form_fields(): false

Returns: false: in case of error, true otherwise

Source: shared/code/tce_functions_form.php:219

F_check_required_fields()

Check Required Form Fields.<br> Returns a string containing a list of missing fields (comma separated).

function F_check_required_fields(mixed $formfields): array

Parameters:

  • $formfields (mixed): (string) input array containing form fields

Returns: array: containing a list of missing fields (if any)

Source: shared/code/tce_functions_form.php:77

F_close_button()

Returns XHTML code string to display a window close button

function F_close_button(mixed $onclick = ''): XHTML

Parameters:

  • $onclick (mixed): (string) additional javascript code to execute before closing the window.

Returns: XHTML: code string

Source: shared/code/tce_functions_form.php:246

F_decode_form_fields()

Returns an array containing form fields.

function F_decode_form_fields(): array

Returns: array: containing form fields

Source: shared/code/tce_functions_form.php:66

F_get_field_format_registry()

Server-side registry of canonical field-format patterns, keyed by form field name.

This is the single source of truth used by F_check_fields_format() to validate submitted values. The matching pattern is resolved here, on the server, by field name.

Field names are static across the application, so a flat “name => un-delimited regex” map is sufficient. Configurable constants are reused where they already exist.

function F_get_field_format_registry(): array<string,string>

Returns: array<string,string>: map of field name to un-delimited regular expression

Source: shared/code/tce_functions_form.php:123

F_getCSRFTokenField()

Returns XHTML code string to display the CSRF token field.

function F_getCSRFTokenField(): XHTML

Returns: XHTML: code string

Source: shared/code/tce_functions_form.php:298

F_submit_button()

Returns XHTML code string to display Form Submit Button.

function F_submit_button(mixed $name, mixed $value, mixed $title = '', mixed $extra = ''): XHTML

Parameters:

  • $name (mixed): (string) button name
  • $value (mixed): (string) label for button
  • $title (mixed): (string) button title, default=’'
  • $extra (mixed): (string) optional extra fields to add to the input tag, default=''

Returns: XHTML: code string

Source: shared/code/tce_functions_form.php:277

getFormDescriptionLine()

Print form row with label and description

function getFormDescriptionLine(mixed $name, mixed $description = '', mixed $value = ''): string

Parameters:

  • $name (mixed): (string) Label.
  • $description (mixed): (string) Label description (tooltip).
  • $value (mixed): (string) Initial value.

Returns: string

Source: shared/code/tce_functions_form.php:834

getFormNoscriptSelect()

Print form row with submit button when noscript is active.

function getFormNoscriptSelect(mixed $name = 'selectrecord'): string

Parameters:

  • $name (mixed): (string) Name of the input form field.

Returns: string

Source: shared/code/tce_functions_form.php:812

getFormRowCheckBox()

Print check box row form.

function getFormRowCheckBox(
    mixed $field_name,
    mixed $name,
    mixed $description = '',
    mixed $tip = '',
    mixed $value = '',
    mixed $selected = false,
    mixed $disabled = false,
    mixed $prefix = ''
): string

Parameters:

  • $field_name (mixed): (string) Name of the form field.
  • $name (mixed): (string) Label.
  • $description (mixed): (string) Label description (tooltip).
  • $tip (mixed): (string) Help to be displayed on the right of the input field.
  • $value (mixed): (string) Initial value.
  • $selected (mixed): (boolean) set to true if selected.
  • $disabled (mixed): (boolean) set to true to disable the field
  • $prefix (mixed): (string) code to be displayed after label.

Returns: string

Source: shared/code/tce_functions_form.php:623

getFormRowFixedValue()

Print fixed value row form.

function getFormRowFixedValue(
    mixed $field_name,
    mixed $name,
    mixed $description = '',
    mixed $tip = '',
    mixed $value = '',
    mixed $currency = false,
    mixed $prefix = ''
): string

Parameters:

  • $field_name (mixed): (string) Name of the form field.
  • $name (mixed): (string) Label.
  • $description (mixed): (string) Label description (tooltip).
  • $tip (mixed): (string) Help to be displayed on the right of the input field.
  • $value (mixed): (string) Initial value.
  • $currency (mixed): (boolean) if true the value is a curency number.
  • $prefix (mixed): (string) code to be displayed after label.

Returns: string

Source: shared/code/tce_functions_form.php:700

getFormRowSelectBox()

Print select box row form.

function getFormRowSelectBox(
    mixed $field_name,
    mixed $name,
    mixed $description = '',
    mixed $tip = '',
    mixed $value = '',
    mixed $items = [],
    mixed $prefix = '',
    mixed $required = false
): string

Parameters:

  • $field_name (mixed): (string) Name of the form field.
  • $name (mixed): (string) Label.
  • $description (mixed): (string) Label description (tooltip).
  • $tip (mixed): (string) Help to be displayed on the right of the input field.
  • $value (mixed): (string) Initial value.
  • $items (mixed): (array) array of items to print key => value.
  • $prefix (mixed): (string) code to be displayed after label.
  • $required (mixed)

Returns: string

Source: shared/code/tce_functions_form.php:548

getFormRowTextBox()

Print text box row form.

function getFormRowTextBox(
    mixed $field_name,
    mixed $name,
    mixed $description = '',
    mixed $value = '',
    mixed $disabled = false,
    mixed $prefix = '',
    mixed $required = false
): string

Parameters:

  • $field_name (mixed): (string) Name of the form field.
  • $name (mixed): (string) Label.
  • $description (mixed): (string) Label description (tooltip).
  • $value (mixed): (string) Initial value.
  • $disabled (mixed): (boolean) If true disable the field.
  • $prefix (mixed): (string) code to be displayed after label.
  • $required (mixed): (boolean) If true the field is marked as required.

Returns: string

Source: shared/code/tce_functions_form.php:488

getFormRowTextInput()

Print input row form.

function getFormRowTextInput(
    mixed $field_name,
    mixed $name,
    mixed $description = '',
    mixed $tip = '',
    mixed $value = '',
    mixed $format = '',
    mixed $maxlen = 255,
    mixed $date = false,
    mixed $datetime = false,
    mixed $password = false,
    mixed $prefix = '',
    mixed $required = false,
    mixed $autocomplete = '',
    mixed $inputtype = ''
): string

Parameters:

  • $field_name (mixed): (string) Name of the form field.
  • $name (mixed): (string) Label.
  • $description (mixed): (string) Label description (tooltip).
  • $tip (mixed): (string) Help to be displayed on the right of the input field.
  • $value (mixed): (string) Initial value.
  • $format (mixed): (string) Regular expression to check the format of the field.
  • $maxlen (mixed): (int) Maximum input length.
  • $date (mixed): (boolean) True if the field is a date input.
  • $datetime (mixed): (boolean) True if the field is a date-time input.
  • $password (mixed): (boolean) True if the field is a password.
  • $prefix (mixed): (string) code to be displayed after label.
  • $required (mixed): (boolean) If true the field is marked as required.
  • $autocomplete (mixed): (string) HTML autocomplete token (e.g. ’email’, ‘username’, ‘current-password’, ’new-password’).
  • $inputtype (mixed): (string) Override for the HTML input type (e.g. ’email’, ’tel’, ’number’); ignored for password/date/datetime fields.

Returns: string

Source: shared/code/tce_functions_form.php:341

getFormRowVertDiv()

Print form row with title.

function getFormRowVertDiv(mixed $title = ''): string

Parameters:

  • $title (mixed): (string) Title to be printed.

Returns: string

Source: shared/code/tce_functions_form.php:797

getFormRowVertSpace()

Print empty form row.

function getFormRowVertSpace(): string

Returns: string

Source: shared/code/tce_functions_form.php:787

getFormSmallDivSpace()

Print empty form row.

function getFormSmallDivSpace(): string

Returns: string

Source: shared/code/tce_functions_form.php:778

getFormSmallVertSpace()

Print empty form row.

function getFormSmallVertSpace(): string

Returns: string

Source: shared/code/tce_functions_form.php:769

getFormUploadFile()

Print input row form to upluad a file.

function getFormUploadFile(
    mixed $field_name,
    mixed $field_id,
    mixed $name,
    mixed $description = '',
    mixed $onchange = ''
): string

Parameters:

  • $field_name (mixed): (string) Name of the form field.
  • $field_id (mixed): (string) ID of the form field.
  • $name (mixed): (string) Label.
  • $description (mixed): (string) Label description (tooltip).
  • $onchange (mixed): (string) Javascript code to execute at onchange event.

Returns: string

Source: shared/code/tce_functions_form.php:859

getRequiredMark()

Returns the visual “required field” marker to append to a form label.

The control itself should also carry aria-required=“true”.

function getRequiredMark(mixed $required = false): string

Parameters:

  • $required (mixed): (boolean) true if the field is required.

Returns: string: XHTML code (empty string when the field is not required).

Source: shared/code/tce_functions_form.php:309