Exemple #1
0
 /**
  * @param string $id
  * @throws \Loo\Exception\InvalidTypeException
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->setMethod(Request::POST);
     $this->add($this->getElementFactory()->getInputText('name', 'Name')->addAttributes(['placeholder' => L10n::msg('Name'), 'required', 'autofocus']));
     $this->add($this->getElementFactory()->getInputPassword('password', 'Password')->addAttributes(['placeholder' => L10n::msg('Password'), 'required']));
     $this->add($this->getElementFactory()->getSubmit('submit', L10n::msg('Login')));
 }
Exemple #2
0
 /**
  * Test if setting an action gets rendered.
  */
 public function testSetAction()
 {
     $form = new Form('test', new FormElementFactory());
     $form->setAction('index.php');
     $this->assertSame("<form id=\"test\" action=\"index.php\">" . PHP_EOL . PHP_EOL . "</form>" . PHP_EOL, $form->render());
 }