-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contact.php
41 lines (29 loc) · 1023 Bytes
/
Contact.php
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
40
41
<?php
namespace App\Form;
use Aura\Input\Form;
class Contact extends Form
{
public function init()
{
$this->setField('first_name', 'text')
->setAttribs(array(
'id' => 'first_name',
'size' => 20,
'maxlength' => 20,
));
$this->setField('message', 'text')
->setAttribs(array(
'id' => 'message',
'size' => 200,
'maxlength' => 200,
));
// フィルタオブジェクトを取得します。
$filter = $this->getFilter();
// フィルタをセットします。
$filter->addSoftRule('first_name', $filter::IS, 'string');
$filter->addSoftRule('first_name', $filter::IS, 'strlenBetween', 6, 12);
// $filter->addSoftRule('message', $filter::IS, 'string');
// $filter->addSoftRule('message', $filter::IS, 'strlenMin', 6);
// $filter->useFieldMessage('first_name', 'hogehoge');
}
}