Developer's Manual  Blocks  Property types  string

string

Allows to enter string values.

The text type has 5 additional optional parameters: search, chars, size, regex, and error.

search

Optional. Specifies whether to include property value into the search index or not. Possible values for search are:

Value Description
0 Do not include property value into search index.
1 Include property value into search index.

If search is omitted 0 is assumed.

chars

Optional. Specifies allowed characters.

size

Optional. Specifies maximum string size.

regex

Optional. Specifies regular expression for validating the value.

error

Optional. Defines error message text if regular expression failed.

Example

<?
$properties
= Array(
  
'phone' => Array(
    
'type'     => 'string',
    
'value'    => '',
    
'label'    => 'Phone number',
    
'search'   => 1,                    // include into search index
    
'size'     => 15,                   // maximum string size is 15 characters
    
'chars'    => '+01234567890()- ',   // list of allowed characters
    
'regex'    => '^\+',                // first character should be +
    
'error'    => 'Phone number should start with "+"',
  )
);
?>
Please login to add comments.