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


PHP YDForm::getModifiedValues方法代码示例

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


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

示例1: actionDefault

 function actionDefault()
 {
     // Create the form
     $form = new YDForm('form1');
     $form->registerFilter('reverse', 'strrev');
     $form->setDefaults(array('txt2' => 'First text', 'txt3' => "2\nlines", 'hid1' => 'me hidden', 'chk1' => 'x', 'chk2' => false, 'sel1' => 2));
     $text =& $form->addElement('text', 'txt1', 'Enter text 1:');
     $text->_label = 'new label for txt1';
     $form->addElement('text', 'txt2', 'Enter text 2:', array('class' => 'textInputClass', 'name' => 'x'));
     $form->addElement('textarea', 'txt3', 'Enter text 2:');
     $form->addElement('textareacounter', 'txtcounter_1', 'Textarea counter 1', array(), array('maxlength' => 10, 'before' => ' (', 'after' => ' characters remaining)'));
     $form->addElement('textareacounter', 'txtcounter_2', 'Textarea counter 2');
     $form->addElement('radio', 'rad1', 'Select a value 1:', array(), array(1 => 'een', 2 => 'twee'));
     $form->addElement('radio', 'rad2', 'Select a value 2:', array(), array(1 => 'een<br/>', 2 => 'twee'));
     $form->addElement('hidden', 'hid1', '');
     $form->addElement('hidden', 'hid2', '', array(), 'i am also hidden');
     $form->addElement('image', 'img1', '', array(), 'http://www.scripting.com/images/xml.gif');
     $form->addElement('password', 'pas1', 'Enter your password');
     $form->addElement('bbtextarea', 'bbt1', 'Enter your BBCode');
     $form->addElement('checkbox', 'chk1', 'Select me please');
     $form->addElement('checkbox', 'chk2', 'Select me please');
     $form->addElement('select', 'sel1', 'Select an option:', array(), array(1 => 'een', 2 => 'twee'));
     $form->addElement('span', 'span1', 'This is a span. The next element is an image (img).');
     $form->addElement('img', 'img2', 'http://www.scripting.com/images/xml.gif');
     $form->addElement('file', 'fil1', 'Select an file:');
     $form->addElement('submit', 'cmd1', 'Send');
     $form->addElement('reset', 'res1', 'Reset');
     $form->addFilter('__ALL__', 'upper');
     $form->addFilter('txt1', 'trim');
     $form->addFilter('txt2', 'reverse');
     $form->addRule('txt1', 'required', 'txt1 is required');
     $form->addRule('chk2', 'exact', 'chk2 is required', 1);
     $form->addFormRule(array(&$this, 'formrule'), 'txt1 is required');
     if (YDConfig::get('YD_DEBUG') == 1 || YDConfig::get('YD_DEBUG') == 2) {
         YDDebugUtil::dump($form->_regElements, 'Registered elements');
         YDDebugUtil::dump($form->_regRules, 'Registered rules');
         YDDebugUtil::dump($form->_regFilters, 'Registered filters');
         YDDebugUtil::dump($form->_filters, 'Filters');
         YDDebugUtil::dump($form->_rules, 'Rules');
         YDDebugUtil::dump($form->_formrules, 'Form Rules');
         YDDebugUtil::dump($form->getValue('txt1'), 'txt1');
         YDDebugUtil::dump($form->getValue('txt2'), 'txt2');
         YDDebugUtil::dump($_POST, '$_POST');
         YDDebugUtil::dump($_FILES, '$_FILES');
         YDDebugUtil::dump($form->toArray());
     }
     if ($form->validate()) {
         YDDebugUtil::dump($form->getModifiedValues(), 'Form modified values');
         YDDebugUtil::dump($form->getValues(), 'Form values');
     } else {
         $form->display();
     }
     // Create the form
     $form2 = new YDForm('form2');
     $form2->setDefaults(array('txt1' => 'First text'));
     $form2->addElement('text', 'txt1', 'Enter text 1:');
     $form2->addElement('text', 'txt2', 'Enter text 2:');
     $form2->addElement('submit', 'cmd1', 'Send');
     $form2->display();
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:60,代码来源:form2.php

示例2: actionDefault

 function actionDefault()
 {
     // Create the form
     $form = new YDForm('form1');
     $form->addElement('text', 'text1', 'Enter text 1:');
     $form->addElement('text', 'text2', 'Enter text 2:');
     $form->addElement('textarea', 'textarea', 'Enter text 3:');
     $form->addElement('radio', 'radio1', 'Select a value 1:', array(), array(1 => 'one', 2 => 'two'));
     $form->addElement('radio', 'radio2', 'Select a value 2:', array(), array(1 => 'one', 2 => 'two'));
     $form->addElement('hidden', 'hidden1', '');
     $form->addElement('hidden', 'hidden2', '', array(), 'i am also hidden');
     $form->addElement('image', 'image', '', array(), 'http://www.scripting.com/images/xml.gif');
     $form->addElement('password', 'password', 'Enter your password');
     $form->addElement('bbtextarea', 'bbtextarea', 'Enter your BBCode');
     $form->addElement('checkbox', 'checkbox1', 'Check me 1');
     $form->addElement('checkbox', 'checkbox2', 'Check me 2');
     $form->addElement('select', 'select', 'Select an option:', array(), array(1 => 'one', 2 => 'two'));
     $form->addElement('dateselect', 'dateselect', 'Select a date:');
     $form->addElement('datetimeselect', 'datetimeselect', 'Select a date:');
     $form->addElement('timeselect', 'timeselect', 'Select a date:');
     $form->addElement('file', 'file', 'Select an file:');
     $form->addElement('submit', 'submit', 'Send');
     $form->addElement('button', 'button', 'Button');
     $form->addElement('reset', 'resest', 'Reset');
     $form->setDefaults(array('radio1' => 1, 'radio2' => 2, 'text1' => 'my text one', 'select' => 1, 'checkbox1' => 'on'));
     if ($form->validate()) {
         YDDebugUtil::dump($form->getDefaults(), 'Form default values');
         YDDebugUtil::dump($form->getModifiedValues(), 'Form modified values');
         YDDebugUtil::dump($form->getValues(), 'Form values');
     } else {
         $form->display();
     }
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:33,代码来源:form_modified.php


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