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


PHP HTMLForm\CForm类代码示例

本文整理汇总了PHP中Mos\HTMLForm\CForm的典型用法代码示例。如果您正苦于以下问题:PHP CForm类的具体用法?PHP CForm怎么用?PHP CForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->AddElement(new \Mos\HTMLForm\CFormElementText('name'))->AddElement(new \Mos\HTMLForm\CFormElementText('email'))->AddElement(new \Mos\HTMLForm\CFormElementText('phone'))->AddElement(new \Mos\HTMLForm\CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))))->AddElement(new \Mos\HTMLForm\CFormElementSubmit('submit-fail', array('callback' => array($this, 'DoSubmitFail'))));
     $this->SetValidation('name', array('not_empty'))->SetValidation('email', array('not_empty', 'email_adress'))->SetValidation('phone', array('not_empty', 'numeric'));
 }
开发者ID:stjo15,项目名称:janax,代码行数:9,代码来源:test-part5.tpl.php

示例2: __construct

 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->AddElement(new \Mos\HTMLForm\CFormElementText('name'))->AddElement(new \Mos\HTMLForm\CFormElementText('email'))->AddElement(new \Mos\HTMLForm\CFormElementText('phone'))->AddElement(new \Mos\HTMLForm\CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))));
 }
开发者ID:Kajja,项目名称:phpmvc,代码行数:8,代码来源:test-part2.php

示例3: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     $this->currentYear = date("Y");
     parent::__construct([], ['payment' => ['type' => 'hidden', 'value' => 10], 'name' => ['type' => 'text', 'label' => 'Name on credit card:', 'required' => true, 'autofocus' => true, 'validation' => array('not_empty')], 'address' => ['type' => 'text', 'label' => 'Address', 'required' => true, 'validation' => array('not_empty')], 'zip' => ['type' => 'text', 'label' => 'Zip code', 'required' => true, 'validation' => array('not_empty')], 'city' => ['type' => 'text', 'label' => 'City', 'required' => true, 'validation' => array('not_empty')], 'country' => ['type' => 'select', 'label' => 'Country', 'options' => array('default' => 'Select country', 'dk' => 'Denmark', 'fi' => 'Finland', 'no' => 'Norway', 'se' => 'Sweden'), 'validation' => array('not_empty', 'not_equal' => 'default')], 'cctype' => array('type' => 'select', 'label' => 'Credit card type', 'options' => array('default' => 'Select credit card type', 'visa' => 'VISA', 'mastercard' => 'MasterCard', 'eurocard' => 'Eurocard', 'amex' => 'American Express'), 'validation' => array('not_empty', 'not_equal' => 'default')), 'ccnumber' => array('type' => 'text', 'label' => 'Credit card number', 'validation' => array('not_empty', 'custom_test' => array('message' => 'Invalid credit card number, try 4408 0412 3456 7893 or 4417 1234 5678 9113', 'test' => 'isValidCCNumber'))), 'expmonth' => array('type' => 'select', 'label' => 'Expiration month:', 'options' => array('default' => 'Select credit card expiration month...', '01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December'), 'validation' => array('not_empty', 'not_equal' => 'default')), 'expyear' => array('type' => 'select', 'label' => 'Expiration year:', 'options' => array('default' => 'Select credit card expiration year...', $this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear), 'validation' => array('not_empty', 'not_equal' => 'default')), 'cvc' => array('type' => 'text', 'label' => 'CVC:', 'required' => true, 'validation' => array('not_empty', 'numeric')), 'pay' => array('type' => 'submit', 'value' => 'Perform payment', 'callback' => function ($this) {
         return true;
     })]);
 }
开发者ID:helikopterspark,项目名称:DV1483,代码行数:11,代码来源:CFormCCCheckout.php

示例4: __construct

 /**
  * Constructor
  *
  */
 public function __construct($tags = array())
 {
     if (isset($tags[0])) {
         foreach ($tags as $tag) {
             $tagoptions[$tag->id] = $tag->name;
         }
         parent::__construct([], ['subject' => ['type' => 'text', 'placeholder' => 'Rubrik', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Rubrik', 'required' => true, 'validation' => ['not_empty']], 'text' => ['type' => 'textarea', 'placeholder' => 'Fråga', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Fråga', 'required' => true, 'validation' => ['not_empty']], 'old_tags' => ['type' => 'select-multiple', 'placeholder' => 'Taggar', 'id' => 'inputEmail', 'class' => 'form-control', 'options' => $tagoptions, 'label' => 'Befintliga taggar'], 'new_tags' => ['type' => 'text', 'placeholder' => 'Tag?, ', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Skapa nya taggar, separera med komma-tecken'], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'value' => 'Skicka', 'callback' => function () {
             $old_tags = null;
             if (isset($_POST['old_tags'])) {
                 $old_tags = $_POST['old_tags'];
             }
             $res = $this->di->dispatcher->forward(['controller' => 'questions', 'action' => 'add', 'params' => [$this->Value('subject'), $this->Value('text'), $old_tags, $this->Value('new_tags')]]);
             $this->saveInSession = true;
             return $res;
         }]]);
     } else {
         parent::__construct([], ['subject' => ['type' => 'text', 'placeholder' => 'Rubrik', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Rubrik', 'required' => true, 'validation' => ['not_empty']], 'text' => ['type' => 'textarea', 'placeholder' => 'Fråga', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Fråga', 'required' => true, 'validation' => ['not_empty']], 'tags_new' => ['type' => 'text', 'placeholder' => 'Taggar', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Skapa nya taggar, separera med komma-tecken'], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'callback' => function () {
             $res = $this->di->dispatcher->forward(['controller' => 'questions', 'action' => 'add', 'params' => [$this->Value('subject'), $this->Value('text')]]);
             $this->saveInSession = true;
             return $res;
         }], 'submit-fail' => ['type' => 'submit', 'callback' => function () {
             $this->AddOutput("<p><i>DoSubmitFail(): Form was submitted but I failed to process/save/validate it</i></p>");
             return false;
         }]]);
     }
 }
开发者ID:emanuelzone,项目名称:audiobox,代码行数:30,代码来源:CQuestionsForm.php

示例5: check

 /**
  * Customise the check() method.
  *
  * @param callable $callIfSuccess handler to call if function returns true.
  * @param callable $callIfFail    handler to call if function returns true.
  */
 public function check($callIfSuccess = null, $callIfFail = null)
 {
     if ($this->di->request->getPost('submit-abort')) {
         $this->redirectTo('users/id/' . $this->userUpd->getProperties()['id']);
     } else {
         return parent::check([$this, 'callbackSuccess'], [$this, 'callbackFail']);
     }
 }
开发者ID:helikopterspark,项目名称:WGTOTW,代码行数:14,代码来源:CFormEditUser.php

示例6: check

 /**
  * Customise the check() method.
  *
  * @param callable $callIfSuccess handler to call if function returns true.
  * @param callable $callIfFail    handler to call if function returns true.
  */
 public function check($callIfSuccess = null, $callIfFail = null)
 {
     if ($this->di->request->getPost('submit-abort')) {
         $this->redirectTo('question');
     } else {
         return parent::check([$this, 'callbackSuccess'], [$this, 'callbackFail']);
     }
 }
开发者ID:helikopterspark,项目名称:WGTOTW,代码行数:14,代码来源:CFormAddQuestion.php

示例7: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct([], ['acronym' => ['type' => 'text', 'placeholder' => 'Användarnamn', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Användarnamn', 'required' => true, 'validation' => ['not_empty']], 'password' => ['type' => 'password', 'placeholder' => 'Lösenord', 'id' => 'inputPassword', 'class' => 'form-control', 'label' => 'Lösenord: ', 'required' => true, 'validation' => ['not_empty']], 'pwd-repeat' => ['type' => 'password', 'placeholder' => 'Lösenord', 'id' => 'inputPassword', 'class' => 'form-control', 'label' => 'Repetera lösenord', 'required' => true, 'validation' => ['match' => 'password']], 'email' => ['type' => 'text', 'placeholder' => 'E-mail', 'id' => 'inputEmail', 'class' => 'form-control', 'required' => true, 'validation' => ['not_empty', 'email_adress']], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'value' => 'Registrera dig', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'user', 'action' => 'add', 'params' => [$this->Value('acronym'), $this->Value('password'), $this->Value('email')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
开发者ID:emanuelzone,项目名称:audiobox,代码行数:12,代码来源:CRegisterForm.php

示例8: __construct

 /**
  * Constructor
  *
  */
 public function __construct(User $user)
 {
     parent::__construct([], ['acronym' => ['type' => 'text', 'label' => 'Användarnamn', 'required' => true, 'validation' => ['not_empty'], 'value' => $user->acronym], 'text' => ['type' => 'textarea', 'label' => 'Presentation', 'value' => $user->text], 'email' => ['type' => 'text', 'required' => true, 'validation' => ['not_empty', 'email_adress'], 'value' => $user->email], 'id' => ['type' => 'hidden', 'value' => $user->id], 'submit' => ['type' => 'submit', 'value' => 'Spara ändringar', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'user', 'action' => 'update', 'params' => [$this->Value('id'), $this->Value('acronym'), $this->Value('email'), $this->Value('text')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
开发者ID:aa222di,项目名称:phpmvc-bth,代码行数:12,代码来源:CEditForm.php

示例9: __construct

 /**
  * Constructor
  *
  */
 public function __construct($answerId = null, $questionId = null)
 {
     parent::__construct([], ['text' => ['type' => 'textarea', 'placeholder' => '...', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Din kommentar', 'required' => true, 'validation' => ['not_empty']], 'questionId' => ['type' => 'hidden', 'value' => $questionId], 'answerId' => ['type' => 'hidden', 'value' => $answerId], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'value' => 'Skicka', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'comments', 'action' => 'addComment', 'params' => [$this->Value('text'), $this->Value('answerId'), $this->Value('questionId')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
开发者ID:emanuelzone,项目名称:audiobox,代码行数:12,代码来源:CCommentsForm.php

示例10: check

 /**
  * Customise the check() method.
  *
  * @param callable $callIfSuccess handler to call if function returns true.
  * @param callable $callIfFail    handler to call if function returns true.
  */
 public function check($callIfSuccess = null, $callIfFail = null)
 {
     if (isset($_POST['submit-abort'])) {
         $this->redirectTo($this->redirect . '#comments');
     } else {
         return parent::check([$this, 'callbackSuccess'], [$this, 'callbackFail']);
     }
 }
开发者ID:helikopterspark,项目名称:Anax-MVC,代码行数:14,代码来源:CFormAddComment.php

示例11: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct([], ['text' => ['type' => 'textarea', 'label' => 'Ditt svar', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'answers', 'action' => 'add', 'params' => [$this->Value('text')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
开发者ID:aa222di,项目名称:phpmvc-bth,代码行数:12,代码来源:CAnswersForm.php

示例12: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct([], ['acronym' => ['type' => 'text', 'label' => 'Användarnamn', 'required' => true, 'validation' => ['not_empty']], 'password' => ['type' => 'password', 'label' => 'Lösenord', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'value' => 'Logga in', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'user', 'action' => 'login', 'params' => [true, $this->Value('acronym'), $this->Value('password')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
开发者ID:aa222di,项目名称:phpmvc-bth,代码行数:12,代码来源:CLoginForm.php

示例13: check

 /**
  * Customise the check() method.
  *
  * @param callable $callIfSuccess handler to call if function returns true.
  * @param callable $callIfFail    handler to call if function returns true.
  */
 public function check($callIfSuccess = null, $callIfFail = null)
 {
     if ($this->di->request->getPost('submit-abort')) {
         $this->di->session->set('temptag', null);
         // clear temptag info
         $this->redirectTo('tag');
     } else {
         return parent::check([$this, 'callbackSuccess'], [$this, 'callbackFail']);
     }
 }
开发者ID:helikopterspark,项目名称:WGTOTW,代码行数:16,代码来源:CFormEditTag.php

示例14: check

 /**
  * Customise the check() method.
  *
  * @param callable $callIfSuccess handler to call if function returns true.
  * @param callable $callIfFail    handler to call if function returns true.
  */
 public function check($callIfSuccess = null, $callIfFail = null)
 {
     if ($this->di->request->getPost('submit-abort')) {
         $id = $this->di->session->get('id');
         $url = $this->di->url->create('users/id/' . $id);
         $this->redirectTo($url);
     } else {
         return parent::check([$this, 'callbackSuccess'], [$this, 'callbackFail']);
     }
 }
开发者ID:helikopterspark,项目名称:WGTOTW,代码行数:16,代码来源:CFormConfirmDeleteUser.php

示例15: check

 /**
  * Customise the check() method.
  *
  * @param callable $callIfSuccess handler to call if function returns true.
  * @param callable $callIfFail    handler to call if function returns true.
  */
 public function check($callIfSuccess = null, $callIfFail = null)
 {
     return parent::check([$this, 'callbackSuccess'], [$this, 'callbackFail']);
 }
开发者ID:stjo15,项目名称:myDrone,代码行数:10,代码来源:CFormQuestionAdd.php


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