Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 public function render()
 {
     $this->attributes['type'] = 'url';
     // URL type
     $this->validation[] = new \PFBC\Validation\Url();
     parent::render();
 }
Exemplo n.º 3
0
 public function render()
 {
     $this->attributes['type'] = 'number';
     // Number Type
     $this->validation[] = new \PFBC\Validation\Numeric();
     parent::render();
 }
Exemplo n.º 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();
 }
Exemplo n.º 5
0
 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>';
 }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
 public function render()
 {
     $this->validation[] = new \PFBC\Validation\Date();
     parent::render();
 }
Exemplo n.º 8
0
 public function toString()
 {
     $this->convert();
     return parent::toString() . ' ' . $this->getUnitSymbolIfShown();
 }
Exemplo n.º 9
0
 function Datebox(&$lexer, &$container)
 {
     parent::Textbox($lexer, $container);
 }
Exemplo n.º 10
0
 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();
 }
Exemplo n.º 11
0
 public function render()
 {
     $this->attributes['type'] = 'search';
     // Search type
     parent::render();
 }
Exemplo n.º 12
0
 /**
  * @covers Form::registerControl
  */
 public function testRegisterControl()
 {
     $cont = new \Textbox('Mask');
     $this->assertNull($cont->getForm());
     $this->myForm->registerControl($cont);
     $this->assertSame($this->myForm, $cont->getForm());
 }