basic-elements.php
<?php /** * Usage example for HTML_QuickForm2 package: basic elements * * $Id: basic-elements.php,v 1.5 2007/06/30 17:39:41 avb Exp $ */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <mce:style type="text/css"><!-- /* styles borrowed from an older release of Tableless Renderer for QF. Newer styles work worse with nested fieldsets */ body { margin-left: 10px; font-family: Arial,sans-serif; font-size: small; } form { margin: 0; padding: 0; min-width: 500px; max-width: 600px; width: 560px; } form fieldset { border: 1px solid black; padding: 10px 5px; margin: 0; /*width: 560px;*/ } form fieldset.hidden { border: 0; } form fieldset legend { font-weight: bold; } form label { margin: 0 0 0 5px; } form label.qflabel { display: block; float: left; width: 200px; padding: 0; margin: 5px 0 0 0; text-align: right; } form input, form textarea, form select { width: auto; } form textarea { overflow: auto; } form br { clear: left; } form div.qfelement { display: inline; float: left; margin: 5px 0 0 10px; padding: 0; } form div.qfreqnote { font-size: 80%; } form span.error, form span.required { color: red; } form div.error { border: 1px solid red; padding: 5px; } --></mce:style><style type="text/css" mce_bogus="1"> /* styles borrowed from an older release of Tableless Renderer for QF. Newer styles work worse with nested fieldsets */ body { margin-left: 10px; font-family: Arial,sans-serif; font-size: small; } form { margin: 0; padding: 0; min-width: 500px; max-width: 600px; width: 560px; } form fieldset { border: 1px solid black; padding: 10px 5px; margin: 0; /*width: 560px;*/ } form fieldset.hidden { border: 0; } form fieldset legend { font-weight: bold; } form label { margin: 0 0 0 5px; } form label.qflabel { display: block; float: left; width: 200px; padding: 0; margin: 5px 0 0 0; text-align: right; } form input, form textarea, form select { width: auto; } form textarea { overflow: auto; } form br { clear: left; } form div.qfelement { display: inline; float: left; margin: 5px 0 0 10px; padding: 0; } form div.qfreqnote { font-size: 80%; } form span.error, form span.required { color: red; } form div.error { border: 1px solid red; padding: 5px; } </style> <title>HTML_QuickForm2 basic elements example</title> </head> <body> <?php $options = array( 'a' => 'Letter A', 'b' => 'Letter B', 'c' => 'Letter C', 'd' => 'Letter D', 'e' => 'Letter E', 'f' => 'Letter F' ); function output_element($element) { if ('fieldset' == $element->getType()) { output_fieldset($element); } elseif ('hidden' == $element->getType()) { echo '<div style="display: none;" mce_style="display: none;">' . $element->__toString() . "</div>/n"; } else { echo '<div class="qfrow"><label class="qflabel" for="' . $element->getId() . '">' . $element->getLabel() . '</label> <div class="qfelement">' . $element->__toString() . "</div></div><br />/n"; } } function output_fieldset($fieldset) { echo '<fieldset' . $fieldset->getAttributes(true) . ">/n<legend>" . $fieldset->getLabel() . "</legend>/n"; foreach ($fieldset as $element) { output_element($element); } echo "</fieldset>/n"; } require_once 'HTML/QuickForm2.php'; $form = new HTML_QuickForm2('elements'); // data source with default values: $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array( 'textTest' => 'Some text', 'areaTest' => "Some text/non multiple lines", 'userTest' => 'luser', 'selSingleTest' => 'f', 'selMultipleTest' => array('b', 'c'), 'boxTest' => '1', 'radioTest' => '2' ))); // text input elements $fsText = $form->addElement('fieldset')->setLabel('Text boxes'); $fsText->addElement( 'text', 'textTest', array('style' => 'width: 300px;'), array('label' => 'Test Text:') ); $fsText->addElement( 'password', 'pwdTest', array('style' => 'width: 300px;'), array('label' => 'Test Password:') ); $area = $fsText->addElement( 'textarea', 'areaTest', array('style' => 'width: 300px;', 'cols' => 50, 'rows' => 7), array('label' => 'Test Textarea:') ); $fsNested = $form->addElement('fieldset')->setLabel('Nested fieldset'); $fsNested->addElement( 'text', 'userTest', array('style' => 'width: 200px'), array('label' => 'Username:') ); $fsNested->addElement( 'password', 'passTest', array('style' => 'width: 200px'), array('label' => 'Password:') ); // Now we move the fieldset into another fieldset! $fsText->insertBefore($fsNested, $area); // selects $fsSelect = $form->addElement('fieldset')->setLabel('Selects'); $fsSelect->addElement( 'select', 'selSingleTest', null, array('options' => $options, 'label' => 'Single select:') ); $fsSelect->addElement( 'select', 'selMultipleTest', array('multiple' => 'multiple', 'size' => 4), array('options' => $options, 'label' => 'Multiple select:') ); // checkboxes and radios $fsCheck = $form->addElement('fieldset')->setLabel('Checkboxes and radios'); $fsCheck->addElement( 'checkbox', 'boxTest', null, array('content' => 'check me', 'label' => 'Test Checkbox:') ); $fsCheck->addElement( 'radio', 'radioTest', array('value' => 1), array('content' => 'select radio #1', 'label' => 'Test radio:') ); $fsCheck->addElement( 'radio', 'radioTest', array('value' => 2), array('content' => 'select radio #2', 'label' => '(continued)') ); // buttons $fsButton = $form->addElement('fieldset')->setLabel('Buttons'); $testReset = $fsButton->addElement( 'reset', 'testReset', array('value' => 'This is a reset button') ); $fsButton->addElement( 'inputbutton', 'testInputButton', array('value' => 'Click this button', 'onclick' => "alert('This is a test.');") ); $fsButton->addElement( 'button', 'testButton', array('onclick' => "alert('Almost nothing');", 'type' => 'button'), array('content' => '<img src="http://pear.php.net/gifs/pear-icon.gif" mce_src="http://pear.php.net/gifs/pear-icon.gif" '. 'width="32" height="32" alt="pear" />This button does almost nothing') ); // submit buttons in nested fieldset $fsSubmit = $fsButton->addElement('fieldset')->setLabel('These buttons can submit the form'); $fsSubmit->addElement( 'submit', 'testSubmit', array('value' => 'Test Submit') ); $fsSubmit->addElement( 'button', 'testSubmitButton', array('type' => 'submit'), array('content' => '<img src="http://pear.php.net/gifs/pear-icon.gif" mce_src="http://pear.php.net/gifs/pear-icon.gif" '. 'width="32" height="32" alt="pear" />This button submits') ); $fsSubmit->addElement( 'image', 'testImage', array('src' => 'http://pear.php.net/gifs/pear-icon.gif') ); // outputting form values if ('POST' == $_SERVER['REQUEST_METHOD']) { echo "<pre>/n"; var_dump($form->getValue()); echo "</pre>/n<hr />"; // let's freeze the form and remove the reset button $fsButton->removeChild($testReset); $form->toggleFrozen(true); } echo '<form' . $form->getAttributes(true) . ">/n"; foreach ($form as $element) { output_element($element); } ?> </form> </body> </html>
builtin-rules.php
<?php /** * Usage example for HTML_QuickForm2 package: builtin rules * * The example uses all Rule classes provided with HTML_QuickForm2 and also * showcases rule chaining. * * $Id: builtin-rules.php,v 1.1 2007/10/15 08:28:52 avb Exp $ */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <mce:style type="text/css"><!-- /* styles borrowed from an older release of Tableless Renderer for QF. Newer styles work worse with nested fieldsets */ body { margin-left: 10px; font-family: Arial,sans-serif; font-size: small; } form { margin: 0; padding: 0; min-width: 500px; max-width: 600px; width: 560px; } form fieldset { border: 1px solid black; padding: 10px 5px; margin: 0; /*width: 560px;*/ } form fieldset.hidden { border: 0; } form fieldset legend { font-weight: bold; } form label { margin: 0 0 0 5px; } form label.qflabel { display: block; float: left; width: 200px; padding: 0; margin: 5px 0 0 0; text-align: right; } form input, form textarea, form select { width: auto; } form textarea { overflow: auto; } form br { clear: left; } form div.qfelement { display: inline; float: left; margin: 5px 0 0 10px; padding: 0; } form div.qfreqnote { font-size: 80%; } form span.error, form span.required { color: red; } form div.error { border: 1px solid red; padding: 5px; } --></mce:style><style type="text/css" mce_bogus="1"> /* styles borrowed from an older release of Tableless Renderer for QF. Newer styles work worse with nested fieldsets */ body { margin-left: 10px; font-family: Arial,sans-serif; font-size: small; } form { margin: 0; padding: 0; min-width: 500px; max-width: 600px; width: 560px; } form fieldset { border: 1px solid black; padding: 10px 5px; margin: 0; /*width: 560px;*/ } form fieldset.hidden { border: 0; } form fieldset legend { font-weight: bold; } form label { margin: 0 0 0 5px; } form label.qflabel { display: block; float: left; width: 200px; padding: 0; margin: 5px 0 0 0; text-align: right; } form input, form textarea, form select { width: auto; } form textarea { overflow: auto; } form br { clear: left; } form div.qfelement { display: inline; float: left; margin: 5px 0 0 10px; padding: 0; } form div.qfreqnote { font-size: 80%; } form span.error, form span.required { color: red; } form div.error { border: 1px solid red; padding: 5px; } </style> <title>HTML_QuickForm2 basic elements example</title> </head> <body> <?php // // Helper functions // function output_element($element) { if ('fieldset' == $element->getType()) { output_fieldset($element); } elseif ('hidden' == $element->getType()) { echo '<div style="display: none;" mce_style="display: none;">' . $element->__toString() . "</div>/n"; } else { $required = $element->isRequired(); $error = $element->getError(); echo '<div class="qfrow"><label class="qflabel" for="' . $element->getId() . '">' . ($required? '<span class="required">*</span>': '') . $element->getLabel() . '</label> <div class="qfelement' . (strlen($error)? ' error': '') . '">' . (strlen($error)? '<span class="error">' . $error . '</span><br />': '') . $element->__toString() . "</div></div><br />/n"; } } function output_fieldset($fieldset) { echo '<fieldset' . $fieldset->getAttributes(true) . ">/n<legend>" . $fieldset->getLabel() . "</legend>/n"; foreach ($fieldset as $element) { output_element($element); } echo "</fieldset>/n"; } // in real application the password check will a bit be different, of course function check_password($password) { return ($password == 'qwerty'); } // // Form setup // require_once 'HTML/QuickForm2.php'; $form = new HTML_QuickForm2('basicRules'); // for file upload to work $form->setAttribute('enctype', 'multipart/form-data'); // data source with default values: $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array( 'testUsername' => 'luser' ))); // override whatever value was submitted $form->addElement('hidden', 'MAX_FILE_SIZE')->setValue('102400'); // // Simple fields validation, rule chaining // $fsAuth = $form->addElement('fieldset')->setLabel('Auth credentials'); $username = $fsAuth->addElement('text', 'testUsername', array('style' => 'width: 200px;')) ->setLabel('Username (letters only):'); $fsPasswords = $fsAuth->addElement('fieldset') ->setLabel('Supply password only if you want to change it'); $oldPassword = $fsPasswords->addElement('password', 'oldPassword', array('style' => 'width: 200px;')) ->setLabel('Old password (<i>qwerty</i>):'); $newPassword = $fsPasswords->addElement('password', 'newPassword', array('style' => 'width: 200px;')) ->setLabel('New password (min 6 chars):'); $repPassword = $fsPasswords->addElement('password', 'newPasswordRepeat', array('style' => 'width: 200px;')) ->setLabel('Repeat new password:'); $username->addRule('required', 'Username is required'); $username->addRule('regex', 'Username should contain only letters', '/^[a-zA-Z]+$/'); // old password should be either left blank or be equal to 'qwerty' $oldPassword->addRule('empty') ->or_($oldPassword->createRule('callback', 'Wrong password', 'check_password')); // this behaves exactly as it reads: either "password" and "password repeat" // are empty or they should be equal, password should be no less than 6 chars // 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>
您还没有登录,请您登录后再发表评论
类库包,php 开发应用类库,的一部分使用。需要和php的其他类库结合在以起使用。在php的mvc开发模式下需要这个类库
一个工具类, plugins ... 7 (Pear::Html_QuickForm)介绍 8 mail类支持 9 集成log4php->日志开发包 10 支持 WAP 开发 11 图像处理->加水印、缩略图 12 一些插件处理 13 snoopy/httpClient类包(SNOOPY库)
PEAR包含有用的软件库和应用程序,例如MDB2(数据库抽象),HTML_QuickForm(HTML表单管理),PhpDocumentor(自动文档生成器),DB_DataObject(数据访问抽象)等等。 浏览位于所有可用软件包,此列表在不断增长和...
PEAR包含有用的软件库和应用程序,例如MDB2(数据库抽象),HTML_QuickForm(HTML表单管理),PhpDocumentor(自动文档生成器),DB_DataObject(数据访问抽象)等等。 浏览所有可用的软件包,此列表在不断增长和...
Smarty+QUICKFORM小小演示
实例37 HTML QuickForm完成表单验证 实例38 Calendar仓建日历 实例39 File Find搜索文件 实例40 HTTP Upload上传多个文件 实例41 Validate US验证电话号码 实例42 转换日期格式 实例43 用户注册验证 第6章 实现基本...
实例37 HTML QuickForm完成表单验证 实例38 Calendar仓ll建日历 实例39 File Find搜索文件 实例40 HTTP Upload上传多个文件 实例41 Validate US验证电话号码 实例42 转换日期格式 实例43 用户注册验证 第6章 ...
fmDB是用于配置HTML表单(包括选择框和单选复选框)的Web工具。 可视HTML Web界面使配置表单变得容易。 该项目旨在使用PEAR库中的QuickForm和QuickFormController提供PHP代码。
StaticCss::instance()->addCss('http://jquickform.ru/cms/quickform.css'); 相同但浏览器条件 // <!--[lte IE 7]><link rel="stylesheet" href="****.css" media="all" type="text/css" /><![endif]...
QuickForm响应式快速表单模板,使所有过程都在一页上。 表单模板是完全响应式的,并且是免费的。 在此模板中,使用了HTML,CSS和JAVASCRIPT语言。 :camera:桌面截图:登录:注册::camera:手机截图:登录:注册:
gfk:autoform-... 在架构中,该架构将随后与quickForm或afQuickFields : { tags : { type : [ String ] , autoform : { type : "textcomplete" , afFieldInput : { textcompleteStrategies : [ {
在架构中,该架构将随后与quickForm或afQuickFields : { tags : { type : [ String ] , autoform : { type : "selectize" , afFieldInput : { multiple : true , selectizeOptions : { } } } } } 或在...
thegreatshasha:光谱颜色选择器 的附加 Meteor 包。 提供单个自定义输入类型... 在架构中,它将与quickForm或afQuickFields : { date : { type : Date , autoform : { type : "spectrum-colorpicker" } } }
AutoForm 引导程序开关 的附加 Meteor 包。 提供单个自定义输入类型“bootstrap-switch”,它使用插件... 在架构中,它将与quickForm或afQuickFields : { enabled : { type : Boolean , defaultValue : true ,
michalvalasek:autoform-bootstrap-colorpicker 适用于的附加Meteor软件包。 提供单个自定义输入类型“ bootstrap-colorpicker”... 这可以通过多种方式完成: 在架构中,该架构将随后与quickForm或afQuickFields
hausor:autoform-bs-minicolors 的附加 Meteor 包。 提供单个自定义输入类型“bootstrap-minicolors”,它使用插件呈现输入。... 这可以通过多种方式完成: 在架构中,它将与quickForm或afQuickFields :
gildaspk:autoform-moment-datepicker 这个包是的副本,修改为使用插件。 的附加 Meteor 包。 提供单个自定义输入类型“moment-datepicker”... 在架构中,它将与quickForm或afQuickFields : { date : { type :
robertlowe:autoform-pickadate 的附加 Meteor 包。 提供单个自定义输入... 在架构中,它将与quickForm或afQuickFields : { date : { type : Date , autoform : { type : "pickadate" } } } 或者在afField
Meteor Autoform中型编辑器 添加的。 设置 meteor add gildaspk:autoform-medium 用法 您可以直接在模板中应用它: ... // By defaut, we remove the label generated by QuickField or QuickForm
该软件包解决了我在制作离线应用时遇到的一些最常见的问题安装添加包裹meteor add anthonyastige::ground-autoform 像这样将groundType添加到您的表单中{{> quickForm groundType="insert" ...}} 就是这样。...
相关推荐
类库包,php 开发应用类库,的一部分使用。需要和php的其他类库结合在以起使用。在php的mvc开发模式下需要这个类库
一个工具类, plugins ... 7 (Pear::Html_QuickForm)介绍 8 mail类支持 9 集成log4php->日志开发包 10 支持 WAP 开发 11 图像处理->加水印、缩略图 12 一些插件处理 13 snoopy/httpClient类包(SNOOPY库)
PEAR包含有用的软件库和应用程序,例如MDB2(数据库抽象),HTML_QuickForm(HTML表单管理),PhpDocumentor(自动文档生成器),DB_DataObject(数据访问抽象)等等。 浏览位于所有可用软件包,此列表在不断增长和...
PEAR包含有用的软件库和应用程序,例如MDB2(数据库抽象),HTML_QuickForm(HTML表单管理),PhpDocumentor(自动文档生成器),DB_DataObject(数据访问抽象)等等。 浏览所有可用的软件包,此列表在不断增长和...
Smarty+QUICKFORM小小演示
实例37 HTML QuickForm完成表单验证 实例38 Calendar仓建日历 实例39 File Find搜索文件 实例40 HTTP Upload上传多个文件 实例41 Validate US验证电话号码 实例42 转换日期格式 实例43 用户注册验证 第6章 实现基本...
实例37 HTML QuickForm完成表单验证 实例38 Calendar仓ll建日历 实例39 File Find搜索文件 实例40 HTTP Upload上传多个文件 实例41 Validate US验证电话号码 实例42 转换日期格式 实例43 用户注册验证 第6章 ...
fmDB是用于配置HTML表单(包括选择框和单选复选框)的Web工具。 可视HTML Web界面使配置表单变得容易。 该项目旨在使用PEAR库中的QuickForm和QuickFormController提供PHP代码。
StaticCss::instance()->addCss('http://jquickform.ru/cms/quickform.css'); 相同但浏览器条件 // <!--[lte IE 7]><link rel="stylesheet" href="****.css" media="all" type="text/css" /><![endif]...
QuickForm响应式快速表单模板,使所有过程都在一页上。 表单模板是完全响应式的,并且是免费的。 在此模板中,使用了HTML,CSS和JAVASCRIPT语言。 :camera:桌面截图:登录:注册::camera:手机截图:登录:注册:
gfk:autoform-... 在架构中,该架构将随后与quickForm或afQuickFields : { tags : { type : [ String ] , autoform : { type : "textcomplete" , afFieldInput : { textcompleteStrategies : [ {
在架构中,该架构将随后与quickForm或afQuickFields : { tags : { type : [ String ] , autoform : { type : "selectize" , afFieldInput : { multiple : true , selectizeOptions : { } } } } } 或在...
thegreatshasha:光谱颜色选择器 的附加 Meteor 包。 提供单个自定义输入类型... 在架构中,它将与quickForm或afQuickFields : { date : { type : Date , autoform : { type : "spectrum-colorpicker" } } }
AutoForm 引导程序开关 的附加 Meteor 包。 提供单个自定义输入类型“bootstrap-switch”,它使用插件... 在架构中,它将与quickForm或afQuickFields : { enabled : { type : Boolean , defaultValue : true ,
michalvalasek:autoform-bootstrap-colorpicker 适用于的附加Meteor软件包。 提供单个自定义输入类型“ bootstrap-colorpicker”... 这可以通过多种方式完成: 在架构中,该架构将随后与quickForm或afQuickFields
hausor:autoform-bs-minicolors 的附加 Meteor 包。 提供单个自定义输入类型“bootstrap-minicolors”,它使用插件呈现输入。... 这可以通过多种方式完成: 在架构中,它将与quickForm或afQuickFields :
gildaspk:autoform-moment-datepicker 这个包是的副本,修改为使用插件。 的附加 Meteor 包。 提供单个自定义输入类型“moment-datepicker”... 在架构中,它将与quickForm或afQuickFields : { date : { type :
robertlowe:autoform-pickadate 的附加 Meteor 包。 提供单个自定义输入... 在架构中,它将与quickForm或afQuickFields : { date : { type : Date , autoform : { type : "pickadate" } } } 或者在afField
Meteor Autoform中型编辑器 添加的。 设置 meteor add gildaspk:autoform-medium 用法 您可以直接在模板中应用它: ... // By defaut, we remove the label generated by QuickField or QuickForm
该软件包解决了我在制作离线应用时遇到的一些最常见的问题安装添加包裹meteor add anthonyastige::ground-autoform 像这样将groundType添加到您的表单中{{> quickForm groundType="insert" ...}} 就是这样。...