当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML_QuickForm2::getAttributes方法代码示例

本文整理汇总了PHP中HTML_QuickForm2::getAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm2::getAttributes方法的具体用法?PHP HTML_QuickForm2::getAttributes怎么用?PHP HTML_QuickForm2::getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTML_QuickForm2的用法示例。


在下文中一共展示了HTML_QuickForm2::getAttributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: picture

// and old password shuld be given
$newPassword->addRule('empty')->and_($repPassword->addRule('empty'))->or_($newPassword->createRule('eq', 'The passwords do not match', $repPassword))->and_($newPassword->createRule('minlength', 'The password is too short', 6))->and_($oldPassword->createRule('nonempty', 'Supply old password if you want to change it'));
//
// File uploads validation
//
$fsUpload = $form->addElement('fieldset')->setLabel('Upload picture (try one > 100 kB for fun)');
$upload = $fsUpload->addElement('file', 'testUpload', array('style' => 'width: 200px'))->setLabel('Picture (gif, jpg, png, <=20kB):');
// no longer using special 'uploadedfile' rule for uploads
$upload->addRule('required', 'Please upload picture');
// no longer using 'filename' rule for uploads
$upload->addRule('regex', 'Allowed extensions: .gif, .jp(e)g, .png', '/\\.(gif|jpe?g|png)$/i');
$upload->addRule('mimetype', 'Your browser doesn\'t think that\'s an image', array('image/gif', 'image/png', 'image/jpeg', 'image/pjpeg'));
$upload->addRule('maxfilesize', 'File is too big, allowed size 20kB', 20480);
$form->addElement('submit', 'testSubmit', array('value' => 'Send'));
if ($form->validate()) {
    echo "<pre>\n";
    var_dump($form->getValue());
    echo "</pre>\n<hr />";
    $form->toggleFrozen(true);
}
echo '<form' . $form->getAttributes(true) . ">\n";
foreach ($form as $element) {
    output_element($element);
}
?>

</form>

  </body>

</html>
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:31,代码来源:builtin-rules.php


注:本文中的HTML_QuickForm2::getAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。