本文整理汇总了PHP中HTML_QuickForm2::toggleFrozen方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm2::toggleFrozen方法的具体用法?PHP HTML_QuickForm2::toggleFrozen怎么用?PHP HTML_QuickForm2::toggleFrozen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm2
的用法示例。
在下文中一共展示了HTML_QuickForm2::toggleFrozen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
.quickform div.errors ul { margin:0; }
.quickform div.error input { border-color: #C00; background-color: #FEF; }
.quickform div.qf-checkable label,
.quickform div.qf-checkable input { display: inline; float: none; }
.quickform div.qf-checkable div,
.quickform div.qf-message { margin-left: 170px; }
.quickform div.qf-message { font-size: 88%; color: #C00; }
</style>
<title>HTML_QuickForm2 default renderer example</title>
</head>
<body>
<?php
require_once 'HTML/QuickForm2.php';
require_once 'HTML/QuickForm2/Renderer.php';
$form = new HTML_QuickForm2('example');
$fs = $form->addFieldset()->setLabel('Your information');
$username = $fs->addText('username')->setLabel('Username');
$username->addRule('required', 'Username is required');
$password = $fs->addPassword('pass')->setLabel(array('Password', 'Password should be 8 characters at minimum'));
$password->addRule('required', 'Password is required');
$form->addHidden('my_hidden1')->setValue('1');
$form->addHidden('my_hidden2')->setValue('2');
$form->addSubmit('submit', array('value' => 'Send', 'id' => 'submit'));
if ($form->validate()) {
$form->toggleFrozen(true);
}
$renderer = HTML_QuickForm2_Renderer::factory('default')->setOption(array('group_hiddens' => true, 'group_errors' => true, 'required_note' => '<strong>Note:</strong> Required fields are marked with an asterisk (<em>*</em>).'))->setTemplateForId('submit', '<div class="element">{element} or <a href="/">Cancel</a></div>')->setTemplateForClass('HTML_QuickForm2_Element_Input', '<div class="element<qf:error> error</qf:error>"><qf:error>{error}</qf:error>' . '<label for="{id}" class="qf-label<qf:required> required</qf:required>">{label}</label>' . '{element}' . '<qf:label_2><div class="qf-label-1">{label_2}</div></qf:label_2></div>');
echo $form->render($renderer);
?>
</body>
</html>
示例2: _renderRequiredNote
public static function _renderRequiredNote(HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2 $form)
{
if ($renderer->hasRequired && !$form->toggleFrozen(null)) {
if (($note = $renderer->getOption('required_note')) && !empty($note)) {
return '<div class="alert alert-info">' . $note . '</div>';
}
}
}