本文整理汇总了PHP中Form::text方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::text方法的具体用法?PHP Form::text怎么用?PHP Form::text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page
function page()
{
global $db, $session;
//lets get a user
$user = $db->from('users')->where('id', 1);
$formOptions = array('action' => $_SERVER['PHP_SELF'], 'id' => 'testForm', 'data' => $user, 'files' => true, 'class' => 'form-horizontal', 'sidebar' => true, 'title' => '', 'description' => '');
$form = new Form($formOptions, $session);
$sidebar = array('class' => 'warning', 'title' => 'Be careful!', 'body' => 'Be sure you complete all fields');
$form->setSidebar($sidebar);
$emailValidation = array('required' => 'true', 'error' => 'Please supply a valid email address');
$email = array('field' => 'email', 'label' => "Email", 'description' => '', 'validation' => $emailValidation);
$form->email($email);
$firstNameValidation = array();
$firstName = array('field' => 'firstname', 'label' => "First Name", 'description' => '', 'validation' => $firstNameValidation);
$form->text($firstName);
$lastName = array('field' => 'lastname', 'label' => "Last Name", 'description' => 'Fill in your last name');
$form->text($lastName);
$taName = array('field' => 'descriptionField', 'label' => "Last Name", 'description' => 'Fill in your last name');
$form->textarea($taName);
$phoneOptions = array('field' => 'phone', 'label' => "Phone", 'description' => 'Home Phone');
$form->phone($phoneOptions);
$checkOptions = array('field' => 'checkTest', 'label' => "Check here", 'description' => 'You authorize everything');
$form->checkbox($checkOptions);
$passwordValidation = array('pattern' => '(?=^.{6,}$)((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$');
$passwordOptions = array('field' => 'password', 'label' => "Password", 'description' => 'Enter a password at least 6 characters, with at least one symbol and number.', 'validation' => $passwordValidation);
$form->password($passwordOptions);
/*
$dateValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
$secondDateValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
$dateOptions = array('field'=>'startdate', 'label'=>'Start/Stop Dates', 'description' =>'Enter a start and stop date', 'validation' => $dateValidation,
'second_field'=>'enddate', 'second_validation' => $secondDateValidation );
$form->date($dateOptions);
$timeValidation = array('stepping'=>5,'disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
$secondTimeValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
$dateOptions = array('field'=>'starttime', 'label'=>'Start/Stop Times', 'description' =>'Enter a start and stop time', 'validation' => $timeValidation,
'second_field'=>'endtime', 'second_validation' => $secondTimeValidation );
$form->time($dateOptions);
*/
$timeValidation = array('stepping' => 5, 'disabledDays' => '0,1', 'disabledDates' => array("11/23/2015", "12/25/2015"), 'minDate' => '11/1/2015', 'maxDate' => '1/30/2016');
$secondTimeValidation = array('stepping' => 5, 'disabledDays' => '0,1', 'disabledDates' => array("11/23/2015", "12/25/2015"), 'minDate' => '11/1/2015', 'maxDate' => '1/30/2016');
$dateOptions = array('field' => 'startdatetime', 'label' => 'Start/Stop Date Times', 'description' => 'Enter a start and stop date time', 'validation' => $timeValidation, 'second_field' => 'enddatetime', 'second_validation' => $secondTimeValidation);
$form->datetime($dateOptions);
$options = array('field' => 'department', 'options' => array(0 => 'Advertising', 1 => "Circulation", 2 => 'Production'), 'label' => 'Department', 'description' => 'Select your department');
$form->select($options);
$options = array('field' => 'publications', 'url' => '/ajax/forms/publications.php', 'label' => 'Publication', 'description' => 'Select a publication');
$form->remoteSelect($options);
$form->generate();
//var_dump($this->formScripts);
//grab any form scripts and append them to the global scripts array
$GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $form->formScripts);
}
示例2: parseFields
private function parseFields()
{
if (!empty($this->fields)) {
foreach ($this->fields as $key => $value) {
switch ($value['type']) {
case 'text':
$obj = Form::text($key);
break;
case 'long_text':
$obj = Form::textarea($key);
break;
case 'multiple_choice':
$obj = Form::checkboxes($key . "[]");
// create a collection of checkboxeseaa
foreach ($value['options'] as $o => $v) {
$obj->add($o, $v);
}
break;
default:
$obj = Form::text($key);
}
$obj->setLabel($value['label']);
$this->add($obj);
}
}
$this->init();
}
示例3: do_private_post
function do_private_post($content, $results)
{
global $config, $speak;
$results = Mecha::O($results);
$results = $config->is->post ? Get::postHeader($results->path, POST . DS . $config->page_type, '/', $config->page_type . ':') : false;
if ($results === false) {
return $speak->plugin_private_post->description;
}
$s = isset($results->fields->pass) ? $results->fields->pass : "";
if (strpos($s, ':') !== false) {
$s = explode(':', $s, 2);
if (isset($s[1])) {
$speak->plugin_private_post->hint = ltrim($s[1]);
}
// override password hint
$s = $s[0];
}
$hash = md5($s . PRIVATE_POST_SALT);
$html = Notify::read(false) . '<div class="overlay--' . File::B(__DIR__) . '"></div><form class="form--' . File::B(__DIR__) . '" action="' . $config->url . '/' . File::B(__DIR__) . '/do:access" method="post">' . NL;
$html .= TAB . Form::hidden('token', Guardian::token()) . NL;
$html .= TAB . Form::hidden('_', $hash) . NL;
$html .= TAB . Form::hidden('kick', $config->url_current) . NL;
$html .= TAB . '<p>' . $speak->plugin_private_post->hint . '</p>' . NL;
$html .= TAB . '<p>' . Form::text('access', "", $speak->password . '…', array('autocomplete' => 'off')) . ' ' . Form::button($speak->submit, null, 'submit') . '</p>' . NL;
$html .= '</form>' . O_END;
if ($results && isset($results->fields->pass) && trim($results->fields->pass) !== "") {
if (!Guardian::happy() && Session::get('is_allow_post_access') !== $hash) {
return $html;
}
}
return $content;
}
示例4: input
function input($name, $display = null)
{
if ($display == null) {
$display = str_replace('_', ' ', ucfirst($name));
return Form::text($name, null, ['name' => "vinculacion[{$name}]"]) . $display . '<br>';
}
}
示例5: recurse_pages
function recurse_pages($pages, $spaces = 0, $layoutsBlocks = [], $pageWidgets = [], $pagesWidgets = [])
{
$data = '';
foreach ($pages as $page) {
// Блок
$currentBlock = array_get($pageWidgets, $page['id'] . '.0');
$currentPosition = array_get($pageWidgets, $page['id'] . '.1');
$data .= '<tr data-id="' . $page['id'] . '" data-parent-id="' . $page['parent_id'] . '">';
$data .= '<td>';
if (!empty($page['childs'])) {
$data .= '<div class="input-group">';
}
$data .= Form::select('blocks[' . $page['id'] . '][block]', [], $currentBlock, ['class' => 'widget-blocks form-control', 'data-layout' => $page['layout_file'], 'data-value' => $currentBlock]);
if (!empty($page['childs'])) {
$data .= "<div class=\"input-group-btn\">" . Form::button(NULL, ['data-icon' => 'level-down', 'class' => 'set_to_inner_pages btn btn-warning', 'title' => trans('widgets::core.button.select_childs')]) . '</div></div>';
}
$data .= '</td><td>';
$data .= Form::text('blocks[' . $page['id'] . '][position]', (int) $currentPosition, ['maxlength' => 4, 'size' => 4, 'class' => 'form-control text-right widget-position']);
$data .= '</td><td></td>';
if (acl_check('page::edit')) {
$data .= '<th>' . str_repeat("- ", $spaces) . link_to_route('backend.page.edit', $page['title'], [$page['id']]) . '</th>';
} else {
$data .= '<th>' . str_repeat("- ", $spaces) . $page['title'] . '</th>';
}
$data .= '</tr>';
if (!empty($page['childs'])) {
$data .= recurse_pages($page['childs'], $spaces + 5, $layoutsBlocks, $pageWidgets, $pagesWidgets);
}
}
return $data;
}
示例6: get_formulario
public function get_formulario()
{
$variable = Form::open(['url' => '/usuarios/formulario', 'method' => 'post']);
$variable .= Form::text('campo');
$variable .= Form::submit('Enviar');
$variable .= Form::close();
return $variable;
}
示例7: testTextField
/**
* @dataProvider getFieldProvider
*
* @param $fieldName
* @param $fieldTitle
* @param $fieldValue
* @param array $options
* @param string $helpText
*/
public function testTextField($fieldName, $fieldTitle, $fieldValue = null, $options = [], $helpText = '')
{
Form::open(['url' => '/formurl']);
$field = Form::textField($fieldTitle, $fieldName, $fieldValue, $options, $helpText);
Form::close();
$control = Form::text($fieldName, $fieldValue, $this->appendClassToOptions('form-control', $options));
$this->assertEquals(Form::field($fieldTitle, $fieldName, $control, $helpText), $field);
}
示例8: input
function input($name, $display = null)
{
if ($display == null) {
$display = ucfirst($name);
}
$data = array('name' => "cliente[{$name}]");
return Form::text($name, null, $data) . Form::label($name, $display) . '<br>';
}
示例9: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
echo Form::open(array('url' => 'l/ingreso', 'method' => 'post'));
echo Form::text('username');
echo Form::text('password');
echo Form::submit('enviar');
echo Form::close();
}
示例10: get_login
public function get_login()
{
echo "Hello! Welcome to the login page!";
echo Form::open('user/login', 'POST');
echo Form::text('username');
echo Form::submit('Click Me!');
echo Form::close();
}
示例11: inputGroup
function inputGroup($name, $value = NULL, $errors)
{
$errorClass = $errors->first($name) ? "has-error" : "";
$output = "<div class='form-group {$errorClass}'>";
$output .= Form::label($name, ucwords($name));
$output .= Form::text($name, $value, ['class' => 'form-control', 'placeholder' => "Enter {$name}"]);
$output .= $errors->first($name, '<label>:message</label>');
return "{$output}</div>";
}
示例12: page
function page()
{
global $db, $session;
//did we get passed a userid?
$permission = [];
if ($_GET['id']) {
//build up a user
$permissionID = intval($_GET['id']);
$permission = $db->from('core_permission_list')->where('id', $permissionID)->fetch();
}
$formOptions = array('action' => 'permission.php', 'data' => $permission, 'files' => true, 'title' => 'Permission Setup');
$permissionForm = new Form($formOptions);
$options = array('field' => 'displayname', 'label' => "Display name", 'description' => '');
$permissionForm->text($options);
$options = array('field' => 'js_varname', 'label' => "JS variable name", 'description' => '');
$permissionForm->text($options);
$options = array('field' => 'include_js', 'label' => "Include JS in head", 'description' => '');
$permissionForm->checkbox($options);
$permissionForm->generate();
}
示例13: testSaveField
/**
* test method
*/
public function testSaveField()
{
global $tag;
$creator = new WD_Creator_TaxonomyFieldsCreator('category');
$_POST['iname'] = 'mvalue';
$creator->add(Form::text('iname'))->init();
do_action('edited_category', $tag->term_id = 1);
$this->assertEquals($this->output('<tr class="form-field wd-taxonomy-fieldcreator">
<th></th>
<td><input type="text" name="iname" value="mvalue" /></td>
</tr>'), $creator->renderForEdit());
}
示例14: smarty_function_form_text
/**
* @param array $params
* @param Smarty_Internal_Template $smarty
*
* @throws SmartyException
* @return string
*
* @author Kovács Vince
*/
function smarty_function_form_text($params, Smarty_Internal_Template &$smarty)
{
if (!isset($params['_name'])) {
throw new SmartyException('Missing _name attribute for form_text tag');
}
$name = $params['_name'];
$value = isset($params['_value']) ? $params['_value'] : (isset($params['_populate']) ? \Input::get($name) : null);
unset($params['_name']);
unset($params['_value']);
unset($params['_populate']);
return Form::text($name, $value, $params);
}
示例15: request
protected function request()
{
$f = new Form();
$f->start($_POST);
$f->radio('dest', 'Screen', 'screen');
$f->hspace(2);
$f->radio('dest', 'PDF', 'pdf', false);
$f->hspace(2);
$f->radio('dest', 'CSV', 'csv', false);
$f->text('year', 'Year:', 30, 'YYYY');
$f->button('action_report', 'Report', false);
$f->end();
}