public function testVerificaSeOsDadosForamInseridos() { $select = new Select(); $select->setId("selectCat"); $select->setName("categoria"); $select->setClass("form-control"); $select->setProtected("protected"); $select->setLabel("Categoria"); $select->setAlert("Erro no field."); $this->assertEquals("selectCat", $select->getId()); $this->assertEquals("categoria", $select->getName()); $this->assertEquals("form-control", $select->getClass()); $this->assertEquals("protected", $select->getProtected()); $this->assertEquals("Categoria", $select->getLabel()); $this->assertEquals("Erro no field.", $select->getAlert()); }
public function testGetHtmlJs() { $selectId = 'testId'; $selectClass = 'testClass'; $selectTitle = 'testTitle'; $selectName = 'testName'; $options = ['testValue' => 'testLabel', 'selectedValue' => 'selectedLabel']; $selectedValue = 'selectedValue'; $this->select->setId($selectId); $this->select->setClass($selectClass); $this->select->setTitle($selectTitle); $this->select->setName($selectName); $this->select->setOptions($options); $this->select->setValue($selectedValue); $result = '<select name="testName" id="testId" class="testClass" title="testTitle" >' . '<option value="testValue" #{option_extra_attr_4016862802} >testLabel</option>' . '<option value="selectedValue" selected="selected" #{option_extra_attr_662265145} >selectedLabel</option>' . '</select>'; $this->select->setIsRenderToJsTemplate(true); $this->assertEquals($result, $this->select->getHtml()); }
<head> <meta charset="utf-8"> <title>Form Class</title> </head> <body> <form class="" action="task13.php" method="post"> <input type="text" name="name" value="<?php echo isset($_POST['name']) ? $_POST['name'] : ''; ?> "> <input type="text" name="username" value="<?php echo isset($_POST['username']) ? $_POST['username'] : ''; ?> "> <input type="text" name="email" value="<?php echo isset($_POST['email']) ? $_POST['email'] : ''; ?> "> <?php $select = new Select(); $select->setName('browser'); if (isset($browserTypes)) { $select->setValue($browserTypes); $select->makeSelect(); } ?> <input type="submit" name="submit" value="Submit"> </form> </body> </html>
$selectBrowser = new Select(); $selectBrowser->setName('browser'); echo '<p>Work Access</p>'; if (isset($browserTypes)) { $selectBrowser->setValue($browserTypes); $selectBrowser->makeSelect(); unset($selectBrowser); } echo '<p>Connection Speed</p>'; $selectSpeed = new Select(); $selectSpeed->setName('speeds'); if (isset($speeds)) { $selectSpeed->setValue($speeds); $selectSpeed->makeSelect(); unset($selectSpeed); } echo '<p>Operating System</p>'; $selectOs = new Select(); $selectOs->setName('os'); if (isset($os)) { $selectOs->setValue($os); $selectOs->makeSelect(); unset($selectOs); } ?> <input type="submit" name="submit" value="Submit"> </form> </div> </body> </html>
include_once './inc/menubar.php'; $body->line("Index creation on table : <b>" . $req->get('table') . "</b><br>"); $form = new Form(); $form->setAction('controller.php'); $form->setJs(' onsubmit="return PSA.indexcol();" '); $form->build(); // TODO: check if table name already exists $name = new Input(); $name->setName('idxname'); $name->setSize(50); $name->setMaxlength(128); $name->setId('idxname'); $body->line('Name : ' . $name->dump() . ' ' . $cmd->dump() . '<br>'); for ($i = 0; $i < sizeof($fields); ++$i) { $select = new Select(); $select->setName('col' . $i); $select->setSize(1); $select->add('', '-'); for ($j = 0; $j < sizeof($fields); ++$j) { $select->add($fields[$j], $fields[$j]); } $body->line('index on : ' . $select->dump() . '<br>'); } $submit->build(); $tblname = new Input(); $tblname->setName('tblname'); $tblname->setSize(128); $tblname->setValue($req->get('table')); $tblname->setType('hidden'); $tblname->build(); unset($form);
</p> <p> Username: <input type="text" name="username" size="60" /> </p> <p> Email: <input type="text" name="email" size="60" /> </p> <p> Browser: <?php //Instantiate object $browser = new Select(); //Set properties $browser->setName('browser'); $browser->setValue($browsers); //The object has the data it needs from the preceding commands. //Tell it to make the select field. $browser->makeSelect(); ?> </p> <p> <input type="submit" name="submit" value="Go" /> </p> </form> <?php //If form submitted, process input. } else { //Retrieve user responses. $name = $_POST['name'];
$table->build(); $th = new Th(); $th->add('name'); $th->add('type'); $th->add('primary'); $th->add('size'); $th->add('null'); $th->add('default'); $th->build(); $colname = new Input(); $colname->setName('colname'); $colname->setSize(25); $colname->setMaxlength(128); $colname->setId('colname'); $coltype = new Select(); $coltype->setName('coltype'); $coltype->setSize(1); $coltype->setId('coltype'); $coltype->add('VARCHAR', 'VARCHAR'); $coltype->add('INTEGER', 'INTEGER'); $coltype->add('FLOAT', 'FLOAT'); $coltype->add('TEXT', 'TEXT'); $coltype->add('DATETIME', 'DATETIME'); $colprime = new Input(); $colprime->setName('colprime'); $colprime->setType('checkbox'); $colprime->setId('colprime'); $colprime->setJs(' onclick="PSA.checkprimary();" '); $colsize = new Input(); $colsize->setName('colsize'); $colsize->setSize(7);