WebFioriAPI ReferenceLearnDownloadContributeLearn{{result.parent_page}} > {{result.title}}{{result.title}}Classes{{result.class_name}}{{result.summary}}Methods{{result.name}}{{result.summary}}

namespace \webfiori\ui

class Input

Class Attributes Summary

const INPUT_MODESAn array of supported input modes.const INPUT_TYPESAn array of supported input types.

Class Methods Summary

public function __construct(string$type)Creates new instance of the class.public function addChild(HTMLNode|string$node, array|boolean$attrs, boolean$chainOnParent)Adds new child node.public function addOption(array$options)Adds an option to the input element which has the type 'select'.public function addOptions(array$arrayOfOpt)Adds multiple options at once to an input element of type 'select'.public function addOptionsGroup(array$optionsGroupArr)Adds an 'optgroup' child element.public function getType()Returns the value of the attribute 'type'.public function setInputMode(string$mode)Sets the value of the attribute 'inputmode'.public function setList(string$listId)Sets the value of the attribute 'list'public function setMax(string$max)Sets the value of the attribute 'max'.public function setMaxLength(string$length)Sets the value of the attribute 'maxlength'.public function setMin(string$min)Sets the value of the attribute 'min'.public function setMinLength(string$length)Sets the value of the attribute 'minlength'.public function setNodeName(string$name)A method that does nothing.public function setPlaceholder(string|null$text)Sets a placeholder text for the input element if it supports it.public function setType(string$type)Sets the value of the attribute 'type'.public function setValue(string$text)Sets the value of the attribute 'value'

Class Attributes Details

const INPUT_MODESAn array of supported input modes. The array contains the following values:
  • none
  • text
  • decimal
  • numeric
  • tel
  • search
  • email
  • url
const INPUT_TYPESAn array of supported input types. This array has the following values:
  • text
  • date
  • password
  • submit
  • checkbox
  • email
  • url
  • tel
  • color
  • file
  • range
  • month
  • number
  • date-local
  • hidden
  • time
  • week
  • search
  • select
  • textarea
  • radio

Class Methods Details

public function __construct(string$type)Creates new instance of the class.

Parameters:

  • string $type The type of the input element. If the given type is not in the array Input::INPUT_TYPES, 'text' will be used by default.
public function addChild(HTMLNode|string$node, array|boolean$attrs, boolean$chainOnParent)Adds new child node. The node will be added only if the type of the node is <select> and the given node is of type <option> or <optgroup>. Also, if the input type is <textarea> and the given node is a text node, it will be added.

Parameters:

  • HTMLNode|string $node The node that will be added. If a text is given and the node is of type <textarea>, The text will be added to the body of the text area. If input type is <select>, then new option will be added with the same label of the given text.
  • array|boolean $attrs An optional array of attributes which will be set in the newly added child. Also, this argument can work as last method argument if a boolean is given.
  • boolean $chainOnParent If this parameter is set to true, the method will return the same instance at which the child node is added to. If set to false, the method will return the child which have been added. This can be useful if the developer would like to add a chain of elements to the body of the node. Default value is true.
Returns: HTMLNodeIf the parameter $useChaining is set to true, the method will return the '$this' instance. If set to false, it will return the newly added child. If no child is added, the method will return null.
public function addOption(array$options)Adds an option to the input element which has the type 'select'.

Parameters:

  • array $options An associative array that contains select options. The array must have at least the following indices:
    • label: A label that will be displayed to the user.
    • value: The value that will be set for the attribute 'value'.
    • attributes: An associative array of attributes which can be set for the option.
    In addition to the two indices, the array can have additional index. The index name is 'attributes'. This index can have an associative array of attributes which will be set for the option. The key will act as the attribute name and the value of the key will act as the value of the attribute.
Returns: InputThe method will return the instance at which the method is called on.
public function addOptions(array$arrayOfOpt)Adds multiple options at once to an input element of type 'select'.

Parameters:

  • array $arrayOfOpt An associative array of options. The key will act as the 'value' attribute and the value of the key will act as the label for the option. Also, it is possible that the value of the key is a sub-associative array that contains only two indices:
    • label: A label for the option.
    • attributes: An optional associative array of attributes for the option. The key will act as the attribute name and the value of the key will act as the value of the attribute.
Returns: InputThe method will return the instance at which the method is called on.
public function addOptionsGroup(array$optionsGroupArr)Adds an 'optgroup' child element.

Parameters:

  • array $optionsGroupArr An associative array that contains group info. The array must have the following indices:
    • label: The label of the group.
    • attributes: An optional associative array that contains group attributes.
    • options: A sub associative array that contains group options. The key will act as the 'value' attribute and the value of the key will act as the label for the option. Also, it is possible that the value of the key is a sub-associative array that contains only two indices:
      • label: A label for the option.
      • attributes: An optional associative array of attributes. The key will act as the attribute name and the value of the key will act as the value of the attribute.
Returns: InputThe method will return the instance at which the method is called on.
public function getType()Returns the value of the attribute 'type'. Returns: string|nullThe value of the attribute 'type'. For 'textarea' and select, this method will return null.public function setInputMode(string$mode)Sets the value of the attribute 'inputmode'.

Parameters:

  • string $mode The value to set. It must be a value from the array Input::INPUT_MODES.
Returns: InputThe method will return the instance at which the method is called on.
public function setList(string$listId)Sets the value of the attribute 'list'

Parameters:

  • string $listId The ID of the element that will be acting as pre-defined list of elements. It cannot be set for hidden, file, checkbox, textarea, select and radio input types.
Returns: InputThe method will return the instance at which the method is called on.
public function setMax(string$max)Sets the value of the attribute 'max'.

Parameters:

Returns: InputThe method will return the instance at which the method is called on.
public function setMaxLength(string$length)Sets the value of the attribute 'maxlength'.

Parameters:

  • string $length The value to set. The attribute value can be set only for text, email, search, tel and url input types.
Returns: InputThe method will return the instance at which the method is called on.
public function setMin(string$min)Sets the value of the attribute 'min'.

Parameters:

Returns: InputThe method will return the instance at which the method is called on.
public function setMinLength(string$length)Sets the value of the attribute 'minlength'.

Parameters:

  • string $length The value to set. The attribute value can be set only for text, email, search, tel and url input types.
Returns: InputThe method will return the instance at which the method is called on.
public function setNodeName(string$name)A method that does nothing.

Parameters:

Returns: booleanThe method will always return false.
public function setPlaceholder(string|null$text)
Sets a placeholder text for the input element if it supports it. A placeholder can be set for the following input types:
  • text
  • textarea
  • password
  • number
  • search
  • email
  • url

Parameters:

  • string|null $text The value to set. The attribute can be set only if the type of the input is text or password or number. If null is given, the attribute will be unset If it was set.
Returns: InputThe method will return the instance at which the method is called on.
public function setType(string$type)Sets the value of the attribute 'type'.

Parameters:

  • string $type The type of the input element. If the given type is not in the array Input::INPUT_TYPES, The method will not update the type. It can be only a value from the array Input::INPUT_TYPES. Also, if the input type is 'textarea' or 'select', this attribute will never be set using this method.
Returns: InputThe method will return the instance at which the method is called on.
public function setValue(string$text)Sets the value of the attribute 'value'

Parameters:

  • string $text The value to set.
Returns: InputThe method will return the instance at which the method is called on.
mdi-menuAll Classesmdi-chevron-leftAnchorBrCodeSnippetHTMLDocHTMLListHTMLNodeHTMLTableHeadNodeInputJsCodeLabelListItemOrderedListParagraphRadioGroupTableCellTableRowUnorderedListInvalidNodeNameExceptionTemplateNotFoundExceptionCaseConverterJsonJsonConverterJsonIJsonTypesPropertyAPIFilterAbstractWebServiceManagerInfoServiceParamTypesRequestRequestParameterResponseUriWebServicesManagerAccessAutoLoaderConfigConfigControllerDBEAbstractWebServiceExtendedWebServicesManagerFileLoggerPrivilegePrivilegesGroupThemeThemeLoaderUploadFileUploaderUserUtilWebFioriAppLanguageErrorBoxHTTPCodeViewMessageBoxServerErrViewStarterPageWebPageDatabaseSessionStorageDefaultSessionStorageMSSQLSessionDataTableMSSQLSessionsTableMySQLSessionDataTableMySQLSessionsTableSessionSessionOperationsSessionStorageSessionsManagerRouterRouterUriAbstractMiddlewareMiddlewareManagerEmailMessageSMTPAccountSMTPServerClassLoaderExceptionFileExceptionInitializationExceptionInvalidCRONExprExceptionMissingLangExceptionNoSuchThemeExceptionRoutingExceptionSMTPExceptionSessionExceptionUIExceptionAbstractJobCronCronEmailCronJobJobArgumentCronLoginViewCronTasksViewCronViewCronLoginServiceCronLogoutServiceCronServicesManagerForceCronExecutionServiceGetJobsServiceCLICLICommandInputStreamOutputStreamStdInStdOutClassWriterLangClassWriterQueryClassWriterServiceHolderThemeClassWriterWebServiceWriterCreateCLIClassHelperCreateCronJobCreateMiddlewareCreateTableCreateTableObjCreateThemeHelperCreateWebServiceAddCommandCreateCommandCronCommandHelpCommandListCronCommandListRoutesCommandListThemesCommandRunSQLQueryCommandSettingsCommandTestRouteCommandUpdateSettingsCommandUpdateTableCommandVersionCommandAbstractQueryColumnColumnFactoryConditionConnectionConnectionInfoDatabaseDatabaseExceptionDateTimeValidatorEntityMapperExpressionForeignKeyJoinTableResultSetSelectExpressionTableWhereExpressionMySQLColumnMySQLConnectionMySQLQueryMySQLTableMSSQLColumnMSSQLConnectionMSSQLQueryMSSQLTableAbstractCollectionComparableLinkedListNodeQueueStack
Powered By: WebFiori Framework, Vue and VuetifyAll Rights Reserved © 2018 - 2024