-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHTML5TextField.php
More file actions
39 lines (33 loc) · 808 Bytes
/
HTML5TextField.php
File metadata and controls
39 lines (33 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
class HTML5TextField extends TextField {
static $extensions = array(
'HTML5FieldsDecorator'
);
// Value for the type attribute
protected $type = 'text';
// If this field is required, the HTML5 required attribute will be set
protected $requried = false;
// Regular expression validation
protected $pattern;
/**
* @see HTML5FieldsDecorator::defaultField()
*/
public function Field() {
return $this->defaultField();
}
/**
* @see FormField::FieldHolder()
*/
public function FieldHolder() {
return $this->defaultFieldHolder();
}
/**
* Set the pattern attribute for in-browser regular expression validation
* Regular expressions have an implied ^(:? and )$
*
* @param string $regex
*/
public function setPattern( $regex ) {
$this->owner->pattern = $regex;
}
}