ValidForm Builder API Documentation

Text extends Element
in package

Text Class is the most used.

Text objects are used to create input[type='text'] fields.

Example; Add a text field with some validation and custom classes to the form.

$objForm->addField(
    "first-name",
    "First name",
    ValidForm::VFORM_STRING,
    array(
        // Make this field required
        "required" => true,
        // It should have a maximum of 10 characters
        "maxLength" => 10,
        // It should have a minimum of 3 characters
        "minLength" => 3
    ),
    array(
        // Error message when required state isn't met
        "required" => "This is a required field",
        // Error message when input length is larger than 10 characters
        "maxLength" => "Maximum of %s characters allowed.",
        // Error message when input length is shorter than 3 characters
        "minLength" => "Minimum of %s characters required."
    ),
    array(
        // Add a custom class to the input element
        // This results in something like
        // <input type='text' class='vf__text custom-class'>
        "fieldclass" => "custom-class",
        // Add a custom class to the field container
        // This results in
        // <div class='vf__required container-class'>
        //     <input type='text'>
        // </div>
        "class" => "container-class"

    )
);
Tags
author

Felix Langfeldt [email protected]

author

Robin van Baalen [email protected]

version
5.3.0

Table of Contents

Methods

addField()  : Element
getDynamicLabelMate()  : array<string|int, mixed>
getDynamicRemoveLabelMate()  : array<string|int, mixed>
getHint()  : string
getId()  : string
getLabel()  : string
getMagicMeta()  : array<string|int, mixed>
getMagicReservedMeta()  : array<string|int, mixed>
getParent()  : Base
getRequiredStyle()  : string
getReservedFieldMeta()  : array<string|int, mixed>
getReservedLabelMeta()  : array<string|int, mixed>
getReservedMeta()  : array<string|int, mixed>
getTip()  : string
getTipMeta()  : array<string|int, mixed>
getType()  : int
getValidator()  : FieldValidator
setConditions()  : void
setHint()  : void
setId()  : void
setLabel()  : void
setName()  : void
setParent()  : void
setRequiredStyle()  : void
setTip()  : void
setType()  : void
setValidator()  : void

Methods

addField()

public addField() : Element

addField($name, $type, $validationRules = array(), $errorHandlers = array(), $meta = array()) Adds another field to this field if this field is a container

Return values
Element

getDynamicLabelMate()

public getDynamicLabelMate() : array<string|int, mixed>

getDynamicLabelMate() Returns the value of $__dynamiclabelmeta

Return values
array<string|int, mixed>

getDynamicRemoveLabelMate()

public getDynamicRemoveLabelMate() : array<string|int, mixed>

getDynamicRemoveLabelMate() Returns the value of $__dynamicremovelabelmeta

Return values
array<string|int, mixed>

getHint()

public getHint() : string

getHint() Returns the value of $__hint

Return values
string

getId()

public getId() : string

getId() Returns the value of $__id

Return values
string

getLabel()

public getLabel() : string

getLabel() Returns the value of $__label

Return values
string

getMagicMeta()

public getMagicMeta() : array<string|int, mixed>

getMagicMeta() Returns the value of $__magicmeta

Return values
array<string|int, mixed>

getMagicReservedMeta()

public getMagicReservedMeta() : array<string|int, mixed>

getMagicReservedMeta() Returns the value of $__magicreservedmeta

Return values
array<string|int, mixed>

getParent()

public getParent() : Base

getParent() Returns the value of $__parent

Return values
Base

getRequiredStyle()

public getRequiredStyle() : string

getRequiredStyle() Returns the value of $__requiredstyle

Return values
string

getReservedFieldMeta()

public getReservedFieldMeta() : array<string|int, mixed>

getReservedFieldMeta() Returns the value of $__reservedfieldmeta

Return values
array<string|int, mixed>

getReservedLabelMeta()

public getReservedLabelMeta() : array<string|int, mixed>

getReservedLabelMeta() Returns the value of $__reservedlabelmeta

Return values
array<string|int, mixed>

getReservedMeta()

public getReservedMeta() : array<string|int, mixed>

getReservedMeta() Returns the value of $__reservedmeta

Return values
array<string|int, mixed>

getTip()

public getTip() : string

getTip() Returns the value of $__tip

Return values
string

getTipMeta()

public getTipMeta() : array<string|int, mixed>

getTipMeta() Returns the value of $__tipmeta

Return values
array<string|int, mixed>

getType()

public getType() : int

getType() Returns the value of $__type

Return values
int

setConditions()

public setConditions() : void

setConditions(array $value) Overwrites the value of $__conditions

setHint()

public setHint() : void

setHint(string $value) Overwrites the value of $__hint

setId()

public setId() : void

setId(string $value) Overwrites the value of $__id

setLabel()

public setLabel() : void

setLabel(string $value) Overwrites the value of $__label

setName()

public setName() : void

setName(string $value) Overwrites the value of $__name

setParent()

public setParent() : void

setParent(Base $value) Overwrites the value of $__parent

setRequiredStyle()

public setRequiredStyle() : void

setRequiredStyle(string $value) Overwrites the value of $__requiredstyle

setTip()

public setTip() : void

setTip(string $value) Overwrites the value of $__tip

setType()

public setType() : void

setType(integer $value) Overwrites the value of $__type

setValidator()

public setValidator() : void

setValidator(FieldValidator $value) Overwrites the value of $__validator


        
On this page

Search results