Example #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);
 }
Example #2
0
 public function render()
 {
     $this->attributes['type'] = 'url';
     // URL type
     $this->validation[] = new \PFBC\Validation\Url();
     parent::render();
 }
 public function render()
 {
     $this->attributes['type'] = 'number';
     // Number Type
     $this->validation[] = new \PFBC\Validation\Numeric();
     parent::render();
 }
Example #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();
 }
Example #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>';
 }
Example #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();
 }
 public function render()
 {
     $this->validation[] = new \PFBC\Validation\Date();
     parent::render();
 }
 public function toString()
 {
     $this->convert();
     return parent::toString() . ' ' . $this->getUnitSymbolIfShown();
 }
Example #9
0
 function Datebox(&$lexer, &$container)
 {
     parent::Textbox($lexer, $container);
 }
Example #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();
 }
 public function render()
 {
     $this->attributes['type'] = 'search';
     // Search type
     parent::render();
 }
Example #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());
 }