/** * Test for whole TbForm class. * Just ensure that class works fine. */ public function testCommon() { $model = new FakeTbFormModel(); $form = new TbForm(array('title' => 'Form builder test form', 'showErrorSummary' => true, 'activeForm' => array('type' => 'horizontal', 'htmlOptions' => array('class' => 'well', 'style' => 'width:500px')), 'elements' => array('text' => array('type' => 'text'), 'hidden' => array('type' => 'hidden'), 'password' => array('type' => 'password'), 'textarea' => array('type' => 'textarea'), 'file' => array('type' => 'file'), 'radio' => array('type' => 'radio'), 'checkbox' => array('type' => 'checkbox'), 'listbox' => array('type' => 'listbox'), 'dropdownlist' => array('type' => 'dropdownlist'), 'checkboxlist' => array('type' => 'checkboxlist'), 'radiolist' => array('type' => 'radiolist'), 'url' => array('type' => 'url'), 'email' => array('type' => 'email'), 'number' => array('type' => 'number'), 'range' => array('type' => 'range'), 'date' => array('type' => 'date'), 'time' => array('type' => 'time'), 'tel' => array('type' => 'tel'), 'search' => array('type' => 'search'), 'toggle' => array('type' => 'toggle'), 'datepicker' => array('type' => 'datepicker'), 'daterange' => array('type' => 'daterange'), 'timepicker' => array('type' => 'timepicker'), 'datetimepicker' => array('type' => 'datetimepicker'), 'select2' => array('type' => 'select2'), 'redactor' => array('type' => 'redactor'), 'html5editor' => array('type' => 'html5editor'), 'markdowneditor' => array('type' => 'markdowneditor'), 'ckeditor' => array('type' => 'ckeditor'), 'typeahead' => array('type' => 'typeahead'), 'maskedtext' => array('type' => 'maskedtext', 'mask' => 'DD/DD/DDDD'), 'colorpicker' => array('type' => 'colorpicker'), 'pass' => array('type' => 'pass')), 'buttons' => array('submit' => array('type' => 'primary', 'buttonType' => 'submit', 'label' => 'Submit'), 'reset' => array('buttonType' => 'reset', 'label' => 'Reset'))), $model); $form->render(); }
<?php defined('SYSPATH') or die('No direct script access.'); echo TbForm::open(NULL, array('class' => 'form-horizontal'), $values, $errors); //echo FORM::open(); ?> <legend>Новый платеж</legend> <br> <br> <table class="table table-condensed"> <tr> <th></th> <th>Название</th> <th>Дней использования</th> <th>Цена</th> </tr> <?php $first_value = current($settings); $current_p_value = Arr::get($values, 'payment_value', $first_value['id']); foreach ($settings as $id => $s) { $checked = $current_p_value == $id ? TRUE : FALSE; ?> <tr> <td><?php echo FORM::radio('payment_value', $id, $checked); ?> </td> <td><?php echo $s['name']; ?>
<?php defined('SYSPATH') or die('No direct script access.'); echo FORM::open($url); ?> <h3>Текст</h3> Город: <?php echo $content->city->name; ?> <div class="clearfix"> <?php echo FORM::textarea('text', $values['text'], array('id' => 'text')); ?> </div> <?php echo TbForm::actions('save', array('horizontal' => FALSE)); echo FORM::close();
$checkboxes = array('active' => array('val' => 1, 'label' => 'Активен')); echo TbForm::open(NULL, array('class' => 'form-horizontal'), $values, $errors); ?> <fieldset> <legend>Параметры страницы</legend> <?php echo TbForm::input('title', array('label' => 'Заголовок')); ?> <?php echo TbForm::checkboxes($checkboxes, 'Статус страницы'); ?> <?php if ($company_name) { ?> <div class="control-group"> <label class="control-label" style="margin-top: 0;"></label> <div class="controls"><?php echo $company_name; ?> </div> </div> <?php } ?> </fieldset> <h3>Текст</h3> <?php echo TbForm::ckeditor('text', array('label' => '')); echo TbForm::actions('save_and_reset', array('horizontal' => FALSE)); echo FORM::close();
<?php echo TbForm::textarea('about', array('label' => __('f_about_service'), 'horizontal' => FALSE)); ?> <div class="control-group"> <label class="control-label"><?php echo __('f_discount'); ?> </label> <div class="controls"> <?php echo FORM::select('discount_id', array('0' => 'нет') + $discounts, Arr::get($values, 'discount_id'), array('id' => 'discount')); ?> </div> </div> <div class="control-group coupon_text"> <label class="control-label"><?php echo __('f_coupon_text'); ?> </label> <div class="controls"> <?php echo FORM::textarea('coupon_text', Arr::get($values, 'coupon_text'), array('class' => 'span6')); ?> </div> </div> </fieldset> </div> </div> <?php echo TbForm::actions('save_and_reset'); echo FORM::close();
echo TbForm::textarea('text', array('label' => 'Вопрос')); ?> </fieldset> <fieldset> <legend>Контактные данные</legend> <?php echo TbForm::input('contact', array('label' => 'Контактное лицо', 'size' => 3)); ?> <?php echo TbForm::input('email', array('label' => 'Email', 'size' => 3)); ?> <?php echo TbForm::input('phone', array('label' => 'Телефон', 'size' => 2)); ?> <div class="control-group"> <label class="control-label">Город</label> <div class="controls"> <?php echo FORM::select('city_id', $cities, Arr::get($values, 'city_id')); ?> </div> </div> <?php echo TbForm::checkboxes($send_checkboxes, 'Запрос адресован сервисам'); ?> <?php echo TbForm::actions('save'); ?> </fieldset> <?php echo FORM::close();