files-shared-code-tce-functions-form

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

tce_functions_form.php

Tags
file

Functions to handle XHTML Form Fields.

author

Nicola Asuni

since
2001-11-07

Table of Contents

Constants

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

Functions

F_decode_form_fields()  : array<string|int, mixed>
Returns an array containing form fields.
F_check_required_fields()  : array<string|int, mixed>
Check Required Form Fields.<br> Returns a string containing a list of missing fields (comma separated).
F_check_fields_format()  : array<string|int, mixed>
Check fields format using regular expression comparisons.<br> Returns a string containing a list of wrong fields (comma separated).
F_check_form_fields()  : false
Check Form Fields.
F_stripslashes_formfields()  : mixed
Strip slashes from posted form fields.
F_close_button()  : XHTML
Returns XHTML code string to display a window close button
F_submit_button()  : XHTML
Returns XHTML code string to display Form Submit Button.
F_getCSRFTokenField()  : XHTML
Returns XHTML code string to display the CSRF token field.
getFormRowTextInput()  : string
Print input row form.
getFormRowTextBox()  : string
Print text box row form.
getFormRowSelectBox()  : string
Print select box row form.
getFormRowCheckBox()  : string
Print check box row form.
getFormRowFixedValue()  : string
Print fixed value row form.
getFormSmallVertSpace()  : string
Print empty form row.
getFormSmallDivSpace()  : string
Print empty form row.
getFormRowVertSpace()  : string
Print empty form row.
getFormRowVertDiv()  : string
Print form row with title.
getFormNoscriptSelect()  : string
Print form row with submit button when noscript is active.
getFormDescriptionLine()  : string
Print form row with label and description
getFormUploadFile()  : string
Print input row form to upluad a file.

Constants

K_EMAIL_RE_PATTERN

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

Functions

F_decode_form_fields()

Returns an array containing form fields.

F_decode_form_fields() : array<string|int, mixed>
Return values
array<string|int, mixed>

containing form fields

F_check_required_fields()

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

F_check_required_fields( $formfields) : array<string|int, mixed>
Parameters
$formfields :

(string) input array containing form fields

Return values
array<string|int, mixed>

containing a list of missing fields (if any)

F_check_fields_format()

Check fields format using regular expression comparisons.<br> Returns a string containing a list of wrong fields (comma separated).

F_check_fields_format( $formfields) : array<string|int, mixed>

NOTE: to check a field create a new hidden field with the same name starting with 'x_'

An example powerful regular expression for email check is: ^([a-zA-Z0-9_.-]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$

Parameters
$formfields :

(string) input array containing form fields

Return values
array<string|int, mixed>

containing a list of wrongfields (if any)

F_check_form_fields()

Check Form Fields.

F_check_form_fields() : false

see: F_check_required_fields, F_check_fields_format

Return values
false

in case of error, true otherwise

F_stripslashes_formfields()

Strip slashes from posted form fields.

F_stripslashes_formfields() : mixed

F_close_button()

Returns XHTML code string to display a window close button

F_close_button([ $onclick = '' ]) : XHTML
Parameters
$onclick : = ''

(string) additional javascript code to execute before closing the window.

Return values
XHTML

code string

F_submit_button()

Returns XHTML code string to display Form Submit Button.

F_submit_button( $name,  $value[,  $title = '' ][,  $extra = '' ]) : XHTML
Parameters
$name :

(string) button name

$value :

(string) label for button

$title : = ''

(string) button title, default=''

$extra : = ''

(string) optional extra fields to add to the input tag, default=''

Return values
XHTML

code string

F_getCSRFTokenField()

Returns XHTML code string to display the CSRF token field.

F_getCSRFTokenField() : XHTML
Return values
XHTML

code string

getFormRowTextInput()

Print input row form.

getFormRowTextInput( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $format = '' ][,  $maxlen = 255 ][,  $date = false ][,  $datetime = false ][,  $password = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$format : = ''

(string) Regular expression to check the format of the field.

$maxlen : = 255

(int) Maximum input lenght.

$date : = false

(boolean) True if the field is a date input.

$datetime : = false

(boolean) True if the field is a date-time input.

$password : = false

(boolean) True if the field is a password.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowTextBox()

Print text box row form.

getFormRowTextBox( $field_name,  $name[,  $description = '' ][,  $value = '' ][,  $disabled = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$value : = ''

(string) Initial value.

$disabled : = false

(boolean) If true disable the field.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowSelectBox()

Print select box row form.

getFormRowSelectBox( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $items = [] ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$items : = []

(array) array of items to print key => value.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowCheckBox()

Print check box row form.

getFormRowCheckBox( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $selected = false ][,  $disabled = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$selected : = false

(boolean) set to true if selected.

$disabled : = false

(boolean) set to true to disable the field

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormRowFixedValue()

Print fixed value row form.

getFormRowFixedValue( $field_name,  $name[,  $description = '' ][,  $tip = '' ][,  $value = '' ][,  $currency = false ][,  $prefix = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$tip : = ''

(string) Help to be displayed on the right of the input field.

$value : = ''

(string) Initial value.

$currency : = false

(boolean) if true the value is a curency number.

$prefix : = ''

(string) code to be displayed after label.

Return values
string

getFormSmallVertSpace()

Print empty form row.

getFormSmallVertSpace() : string
Return values
string

getFormSmallDivSpace()

Print empty form row.

getFormSmallDivSpace() : string
Return values
string

getFormRowVertSpace()

Print empty form row.

getFormRowVertSpace() : string
Return values
string

getFormRowVertDiv()

Print form row with title.

getFormRowVertDiv([ $title = '' ]) : string
Parameters
$title : = ''

(string) Title to be printed.

Return values
string

getFormNoscriptSelect()

Print form row with submit button when noscript is active.

getFormNoscriptSelect([ $name = 'selectrecord' ]) : string
Parameters
$name : = 'selectrecord'

(string) Name of the input form field.

Return values
string

getFormDescriptionLine()

Print form row with label and description

getFormDescriptionLine( $name[,  $description = '' ][,  $value = '' ]) : string
Parameters
$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$value : = ''

(string) Initial value.

Return values
string

getFormUploadFile()

Print input row form to upluad a file.

getFormUploadFile( $field_name,  $field_id,  $name[,  $description = '' ][,  $onchange = '' ]) : string
Parameters
$field_name :

(string) Name of the form field.

$field_id :

(string) ID of the form field.

$name :

(string) Label.

$description : = ''

(string) Label description (tooltip).

$onchange : = ''

(string) Javascript code to execute at onchange event.

Return values
string
On this page
 

© 2004-2024 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy