本文整理汇总了PHP中Forge::checkbox方法的典型用法代码示例。如果您正苦于以下问题:PHP Forge::checkbox方法的具体用法?PHP Forge::checkbox怎么用?PHP Forge::checkbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forge
的用法示例。
在下文中一共展示了Forge::checkbox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$profiler = new Profiler();
$foods = array('tacos' => array('tacos', FALSE), 'burgers' => array('burgers', FALSE), 'spaghetti' => array('spaghetti (checked)', TRUE), 'cookies' => array('cookies (checked)', TRUE));
$form = new Forge(NULL, 'New User');
// Create each input, following this format:
//
// type($name)->attr(..)->attr(..);
//
$form->hidden('hideme')->value('hiddenz!');
$form->input('email')->label(TRUE)->rules('required|valid_email');
$form->input('username')->label(TRUE)->rules('required|length[5,32]');
$form->password('password')->label(TRUE)->rules('required|length[5,32]');
$form->password('confirm')->label(TRUE)->matches($form->password);
$form->checkbox('remember')->label('Remember Me');
$form->checklist('foods')->label('Favorite Foods')->options($foods)->rules('required');
$form->dropdown('state')->label('Home State')->options(locale_US::states())->rules('required');
$form->dateselect('birthday')->label(TRUE)->minutes(15)->years(1950, date('Y'));
$form->submit('save')->value('Save');
if ($form->validate()) {
echo Kohana::debug($form->as_array());
}
echo $form->render();
// Using a custom template:
// echo $form->render('custom_view', TRUE);
// Inside the view access the inputs using $input_id->render(), ->label() etc
//
// To get the errors use $input_id_errors.
// Set the error format with $form->error_format('<div>{message}</div>');
// Defaults to <p class="error">{message}</p>
//
// Examples:
// echo $username->render(); echo $password_errors;
}
示例2: _get_converter_form
private function _get_converter_form()
{
//get all tags
$tags = ORM::factory("tag")->order_by("name", "ASC")->find_all();
foreach ($tags as $tag) {
$tag_array[$tag->id] = $tag->name;
}
//get all users
$users = ORM::factory("user")->order_by("name", "ASC")->find_all();
foreach ($users as $user) {
$user_array[$user->id] = $user->display_name();
}
$form = new Forge("admin/photoannotation/converthandler", "", "post", array("id" => "g-admin-form"));
$form->dropdown("sourcetag")->label(t("Select tag"))->options($tag_array);
$form->dropdown("targetuser")->label(t("Select user"))->options($user_array);
$form->checkbox("deletetag")->label(t("Delete the tag after conversion."));
$form->checkbox("removetag")->label(t("Remove the tag from photos after conversion."));
$form->submit("submit")->value(t("Convert"));
return $form;
}