Version: current

# Class Varchar

Represents a short text field.

  Object
  ViewableData implements IteratorAggregate
  DBField
  StringField
  Varchar

### Direct known subclasses

`DBLocale`, `HTMLVarchar`, `ShopCountry`

Package: sapphire\model
Located at sapphire/core/model/fieldtypes/Varchar.php

## Methods summary

`public unknown_type` | # `__construct( mixed $name, mixed $size = 50, mixed $options = array() )` Construct a new short text field Construct a new short text field #### Parameters $name $name string The name of the field $size $size int The maximum size of the field, in terms of characters $options $options array Optional parameters, e.g. array("nullifyEmpty"=>false). See `StringField::setOptions()` for information on the available options #### Returns `unknown_type` unknown_type #### Overrides `StringField::__construct`
`public` | # `requireField( )` (non-PHPdoc) (non-PHPdoc) #### See ``DBField::requireField()``
`public` | # `Initial( )` Return the first letter of the string followed by a . Return the first letter of the string followed by a .
`public` | # `URL( )` Ensure that the given value is an absolute URL. Ensure that the given value is an absolute URL.
`public string` | # `RTF( )` Return the value of the field in rich text format Return the value of the field in rich text format #### Returns `string` string
`public string` | # `LimitCharacters( mixed $limit = 20, mixed $add = "..." )` Returns the value of the string, limited to the specified number of characters Returns the value of the string, limited to the specified number of characters #### Parameters $limit $limit int Character limit $add $add string Extra string to add to the end of the limited string #### Returns `string` string
`public `FormField`` | # `scaffoldFormField( string $title = null, mixed $params = null )` (non-PHPdoc) (non-PHPdoc) #### Parameters $title string $title Optional. Localized title of the generated instance $params #### Returns ``FormField`` FormField #### See ``DBField::scaffoldFormField()`` #### Overrides `DBField::scaffoldFormField`

### Methods inherited from StringField

`Lower()`, `Upper()`, `getNullifyEmpty()`, `hasValue()`, `prepValueForDB()`, `setNullifyEmpty()`, `setOptions()`

### Methods inherited from DBField

`ATT()`, `HTML()`, `HTMLATT()`, `JS()`, `LowerCase()`, `RAW()`, `RAWURLATT()`, `URLATT()`, `UpperCase()`, `XML()`, `addToQuery()`, `create()`, `debug()`, `defaultSearchFilter()`, `exists()`, `forTemplate()`, `getName()`, `getValue()`, `nullValue()`, `saveInto()`, `scaffoldSearchField()`, `setName()`, `setTable()`, `setValue()`, `writeToManipulation()`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `CurrentMember()`, `CurrentPage()`, `Debug()`, `Even()`, `EvenOdd()`, `First()`, `FirstLast()`, `HasPerm()`, `IsAjax()`, `JS_val()`, `Last()`, `Me()`, `Middle()`, `MiddleString()`, `Modulus()`, `MultipleOf()`, `Odd()`, `Pos()`, `RAW_val()`, `SQL_val()`, `ThemeDir()`, `ThemeName()`, `Top()`, `TotalItems()`, `XML_val()`, `__get()`, `__isset()`, `__set()`, `buildCastingCache()`, `cachedCall()`, `castingClass()`, `castingHelper()`, `castingHelperPair()`, `castingObjectCreator()`, `castingObjectCreatorPair()`, `customise()`, `defineMethods()`, `escapeTypeForField()`, `getField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `hasField()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`, `setField()`

### Methods inherited from Object

`__call()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `createMethod()`, `create_from_string()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`protected mixed` | $size | #

### Properties inherited from StringField

`$nullifyEmpty`

### Properties inherited from DBField

`$arrayValue`, `$defaultVal`, `$default_search_filter_class`, `$escape_type`, `$name`, `$tableName`, `$value`

### Properties inherited from ViewableData

`$casting`, `$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -