本文整理汇总了PHP中Input::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::setValue方法的具体用法?PHP Input::setValue怎么用?PHP Input::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::setValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValue
/**
* @param array $value
* @return Input
*/
public function setValue($value)
{
if (!is_array($value)) {
throw new Exception\InvalidArgumentException(sprintf('Value must be an array, %s given.', gettype($value)));
}
return parent::setValue($value);
}
示例2: __construct
/**
* Método construtor
* @param string $name Nome do campo
* @param string $value Valor do campo
* @param string $label Legenda do campo
*/
public function __construct($name, $value, $label)
{
parent::setName($name);
parent::setValue($value);
parent::setLabel($label);
parent::setType('text');
}
示例3: setValue
public function setValue($newValue)
{
if (!preg_match('#^[^\\:]+\\:\\/\\/#', $newValue)) {
$newValue = 'http://' . $newValue;
}
return parent::setValue($newValue);
}
示例4: testGetValue_Control
/**
* Test setting and getting the value as control
*/
public function testGetValue_Control()
{
$control = $this->getMockBuilder('Jasny\\FormBuilder\\Control')->getMockForAbstractClass();
$control->expects($this->exactly(2))->method('getValue')->will($this->onConsecutiveCalls(42, 51));
$this->input->setValue($control);
$this->assertSame(42, $this->input->getValue());
$this->assertSame(51, $this->input->getValue());
}
示例5: testVerificaSeOsDadosForamInseridos
public function testVerificaSeOsDadosForamInseridos()
{
$input = new Input();
$input->setType("text");
$input->setId("inputUsuario");
$input->setName("usuario");
$input->setClass("form-control");
$input->setProtected("protected");
$input->setLabel("Usuário");
$input->setAlert("Erro no field.");
$input->setValue("valor");
$this->assertEquals("text", $input->getType());
$this->assertEquals("inputUsuario", $input->getId());
$this->assertEquals("usuario", $input->getName());
$this->assertEquals("form-control", $input->getClass());
$this->assertEquals("protected", $input->getProtected());
$this->assertEquals("Usuário", $input->getLabel());
$this->assertEquals("Erro no field.", $input->getAlert());
$this->assertEquals("valor", $input->getValue());
}
示例6: __construct
/**
* \brief Constructor of a form class
* \param string $zone Zone where you want to go
* \param string $page Page related to the zone where you wanna go
* \param string $method A get or post statement
*/
public function __construct($zone, $page, $vars = array(), $method = 'post')
{
$method = strtolower($method);
$allowedSendingMethod = array('get', 'post');
if (!in_array($method, $allowedSendingMethod, true)) {
throw new \Exception('From sending method ' . $method . ' isn\'t allowed.');
}
$this->attributes['action'] = \Kazoo\Page::to($zone, $page, $vars);
$this->attributes['method'] = $method;
$this->inputs = array();
$this->errors = array();
$this->data = array();
// Token generation
$token = new Input('hidden', '_token');
$token->setValue(\Kazoo\Secure::generateToken(sha1($zone . $page . serialize($vars))));
$token->addClosure(function ($data) use($zone, $page, $vars) {
return \Kazoo\Secure::checkToken($data, sha1($zone . $page . serialize($vars)));
});
$this->addInput($token);
}
示例7: Input
* [name] form_base.php
* [package] psa
* [since] 2010.09.22 -ok
*/
$inp_dir = new Input();
$inp_dir->setName('directory');
$inp_dir->setSize(50);
$inp_dir->setValue($result->directory);
$inp_ext = new Input();
$inp_ext->setName('extension');
$inp_ext->setSize(10);
$inp_ext->setValue($result->extension);
$inp_lines = new Input();
$inp_lines->setName('nr_rows');
$inp_lines->setSize(7);
$inp_lines->setValue($result->nr_rows);
$form = new Form();
$form->setAction('controller.php');
$form->build();
$table = new Table();
$table->build();
$tr = new Tr();
$tr->add('Directory : ');
$tr->add($inp_dir->dump());
$tr->add($cmd->dump());
$tr->build();
$tr = new Tr();
$tr->add('Extension : ');
$tr->add($inp_ext->dump());
$tr->build();
$tr = new Tr();
示例8: Input
foreach ($res as $item) {
$colname = $col[$i];
if ($colname == 'id') {
++$i;
continue;
}
// $length = strlen($item);
$size = 50;
/*
if($length < 10) {
$size = 10;
}
*/
$inp = new Input();
$inp->setName($colname);
$inp->setValue($item);
$inp->setSize(50);
$inp->setMaxlength(128);
/**/
$tr = new Tr();
$tr->add($colname);
$tr->add($inp->dump());
$tr->build();
++$i;
/**/
}
$tr = new Tr();
$tr->add(' ');
$tr->add($submit->dump());
$tr->build();
unset($table);
示例9: Input
$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);
$body->line('</div>');
include_once './inc/footer.php';
unset($body);
unset($html);
示例10: Input
$colsize->setMaxlength(7);
$colsize->setId('colsize');
$colsize->setJs(' onblur="PSA.checknumeric();" ');
$colnull = new Input();
$colnull->setName('colnull');
$colnull->setType('checkbox');
$colnull->setId('colnull');
$coldefault = new Input();
$coldefault->setName('coldefault');
$coldefault->setSize(25);
$coldefault->setMaxlength(128);
$coldefault->setId('coldefault');
$fieldadd = new Input();
$fieldadd->setType('button');
$fieldadd->setName('fieldadd');
$fieldadd->setValue('add');
$fieldadd->setJs(' onclick="PSA.addField();" ');
$tr = new Tr();
$tr->add($colname->dump());
$tr->add($coltype->dump());
$tr->setClas('center');
$tr->add($colprime->dump());
$tr->setClas('center');
$tr->add($colsize->dump());
$tr->setClas('center');
$tr->add($colnull->dump());
$tr->add($coldefault->dump());
$tr->add($fieldadd->dump());
$tr->build();
unset($table);
$body->line('<hr />');
示例11: Form
include_once './inc/menubar.php';
$form = new Form();
$form->setAction('controller.php');
$form->build();
$table = new Table();
$table->build();
$i = 0;
/**/
$inp = new Input();
$inp->setName('data_id');
$inp->setValue(-1);
$inp->setType('hidden');
/**/
$data_table = new Input();
$data_table->setName('data_table');
$data_table->setValue($req->get('table'));
$data_table->setType('hidden');
$tr = new Tr();
$tr->add($inp->dump());
$tr->add($data_table->dump());
$tr->add($cmd->dump());
$tr->build();
foreach ($col as $item) {
if ($item == 'id') {
++$i;
continue;
}
// $length = strlen($item);
$size = 50;
/*
if($length < 10) {