Exemplo n.º 1
0
 /**
  * Add element to the form.
  *
  * @param string              $name
  * @param \Rapid\Form\Element $element
  *
  * @return Form
  */
 public function addElement($name, \Rapid\Form\Element $element)
 {
     $element->setAttribute('name', $this->elementName($name));
     $element->setAttribute('id', $this->elementId($name));
     if ($this->model && $this->model->property($name)) {
         $element->setValue($this->model->property($name));
     }
     $this->elements[$name] = $element;
     return $this;
 }
Exemplo n.º 2
0
 public function testSetValue()
 {
     $this->assertNull($this->element->value());
     $this->assertInstanceOf('Rapid\\Form\\Element', $this->element->setValue(1));
     $this->assertEquals(1, $this->element->value());
 }