Pop\Form\Form::getElements PHP Method

getElements() public method

Get the elements of the form object.
public getElements ( ) : array
return array
    public function getElements()
    {
        return $this->form->getChildren();
    }

Usage Example

Example #1
0
 public function testAddElements()
 {
     $e = new Element('text', 'username', 'Username');
     $c = new Checkbox('colors', array('Red', 'Green', 'Blue'));
     $r = new Radio('colors', array('Red', 'Green', 'Blue'));
     $s = new Select('colors', array('Red', 'Green', 'Blue'));
     $t = new Textarea('comments');
     $f = new Form('/submit', 'post');
     $f->addElements($e);
     $f->addElements(array($c, $r, $s, $t));
     $this->assertEquals(5, count($f->getElements()));
     $this->assertInstanceOf('Pop\\Form\\Element', $f->getElement('username'));
     $this->assertTrue($f->isValid());
     $this->assertEquals(0, count($f->getErrors()));
 }