コード例 #1
0
ファイル: TextboxTest.php プロジェクト: jenwachter/html-form
 public function testPattern()
 {
     $field = new Textbox("test", "Test", array("attr" => array("pattern" => "/\\d{4}/")));
     $result = $field->validatePattern("2016");
     $this->assertTrue($result);
     $result = $field->validatePattern("string");
     $this->assertFalse($result);
 }
コード例 #2
0
 public function render()
 {
     $this->attributes['type'] = 'url';
     // URL type
     $this->validation[] = new \PFBC\Validation\Url();
     parent::render();
 }
コード例 #3
0
 public function render()
 {
     $this->attributes['type'] = 'number';
     // Number Type
     $this->validation[] = new \PFBC\Validation\Numeric();
     parent::render();
 }
コード例 #4
0
 public function render()
 {
     $this->_attributes["pattern"] = "#[a-g0-9]{6}";
     $this->_attributes["title"] = "6-digit hexidecimal color (e.g. #000000)";
     $this->validation[] = new \PFBC\Validation\RegExp("/" . $this->_attributes["pattern"] . "/", "Error: The %element% field must contain a " . $this->_attributes["title"]);
     parent::render();
 }
コード例 #5
0
ファイル: Email.php プロジェクト: joswilson/NotJustOK
 public function render()
 {
     $this->attributes['type'] = 'email';
     // Email Type
     $this->validation[] = new \PFBC\Validation\Email();
     parent::render();
     echo '<script src="' . (new \PFBC\Form())->getResourcesPath() . PH7_SH . PH7_JS . 'jquery/mailcheck.js"></script><script src=' . PH7_RELATIVE . 'asset/js/mailcheck.js></script>';
 }
コード例 #6
0
ファイル: Search.php プロジェクト: joswilson/NotJustOK
 public function render()
 {
     $this->attributes['type'] = 'search';
     // Search type
     $this->attributes['x-webkit-speech'] = 'x-webkit-speech';
     // Voice search (only for Webkit engine)
     parent::render();
 }
コード例 #7
0
 public function render()
 {
     $this->validation[] = new \PFBC\Validation\Date();
     parent::render();
 }
コード例 #8
0
 public function toString()
 {
     $this->convert();
     return parent::toString() . ' ' . $this->getUnitSymbolIfShown();
 }
コード例 #9
0
ファイル: t1000.php プロジェクト: HeuristNetwork/heurist
 function Datebox(&$lexer, &$container)
 {
     parent::Textbox($lexer, $container);
 }
コード例 #10
0
ファイル: Week.php プロジェクト: Trieg/php-form-builder-class
 public function render()
 {
     $this->validation[] = new \PFBC\Validation\RegExp("/" . $this->_attributes["pattern"] . "/", "Error: The %element% field must match the following date format: " . $this->_attributes["title"]);
     parent::render();
 }
コード例 #11
0
 public function render()
 {
     $this->attributes['type'] = 'search';
     // Search type
     parent::render();
 }
コード例 #12
0
ファイル: FormTest.php プロジェクト: fruition-sciences/phpfw
 /**
  * @covers Form::registerControl
  */
 public function testRegisterControl()
 {
     $cont = new \Textbox('Mask');
     $this->assertNull($cont->getForm());
     $this->myForm->registerControl($cont);
     $this->assertSame($this->myForm, $cont->getForm());
 }