SimpleForm::addWidget PHP Method

addWidget() public method

Adds a tag contents to the form.
public addWidget ( SimpleWidget $tag )
$tag SimpleWidget Input tag to add.
    public function addWidget($tag)
    {
        if (strtolower($tag->getAttribute('type')) === 'submit') {
            $this->buttons[] = $tag;
        } elseif (strtolower($tag->getAttribute('type')) === 'image') {
            $this->images[] = $tag;
        } elseif ($tag->getName()) {
            $this->setWidget($tag);
        }
    }

Usage Example

示例#1
0
 function testPost()
 {
     $form = new SimpleForm(new SimpleFormTag(array('method' => 'post')), $this->page('C:\\Users\\Garen\\Documents\\CS580\\Recipes\\RecipesInLaravel\\public\\testtt.html'));
     $select = new SimpleSelectionTag(array('name' => 'a'));
     $select->addTag(new SimpleOptionTag(array('value' => 'aaa', 'selected' => '')));
     $form->addWidget($select);
     $this->assertIdentical($form->submit(), new SimplePostEncoding(array('a' => 'aaa')));
 }
All Usage Examples Of SimpleForm::addWidget