• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP RequiredFields类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getFrontEndFormValidator

 public function getFrontEndFormValidator($flexi)
 {
     $validator = new RequiredFields();
     foreach ($flexi->FlexiFormFields()->filter('Required', true) as $field) {
         $validator->addRequiredField($field->SafeName());
     }
     return $validator;
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-flexiform,代码行数:8,代码来源:FlexiFormHandler.php


示例2: get_edit_fields

 static function get_edit_fields($extraFields = null)
 {
     $fields = new FieldSet(new TextField('FirstName', _t('Member.FIRSTNAME', 'First Name')), new TextField('Surname', _t('Member.SURNAME', 'Surname')), new EmailField('Email', _t('Member.EMAIL', 'Email')), new ConfirmedPasswordField('Password', _t('Member.db_Password', 'Password') . ' *'));
     $requiredFields = new RequiredFields('FirstName', 'Surname', 'Email', 'Password');
     if ($extraFields) {
         foreach ($extraFields as $name => $title) {
             $fields->push(new TextField($name, $title));
             $requiredFields->addRequiredField($name);
         }
     }
     return array($fields, $requiredFields);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-merchants,代码行数:12,代码来源:MerchantAdminDOD.php


示例3: testGetStateWithFieldValidationErrors

 public function testGetStateWithFieldValidationErrors()
 {
     $fields = new FieldList(new TextField('Title'));
     $actions = new FieldList();
     $validator = new RequiredFields('Title');
     $form = new Form(new Controller(), 'TestForm', $fields, $actions, $validator);
     $form->loadDataFrom(['Title' => 'My Title']);
     $validator->validationError('Title', 'Title is invalid', 'error');
     $formSchema = new FormSchema();
     $expected = ['id' => 'TestForm', 'fields' => [['id' => 'Form_TestForm_Title', 'value' => 'My Title', 'messages' => [['value' => 'Title is invalid', 'type' => 'error']], 'valid' => false, 'data' => []], ['id' => 'Form_TestForm_SecurityID', 'value' => $form->getSecurityToken()->getValue(), 'messages' => [], 'valid' => true, 'data' => []]], 'messages' => []];
     $state = $formSchema->getState($form);
     $this->assertInternalType('array', $state);
     $this->assertJsonStringEqualsJsonString(json_encode($expected), json_encode($state));
 }
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:14,代码来源:FormSchemaTest.php


示例4: __construct

 /**
  * RegistrationForm constructor
  *
  * @param Controller $controller
  * @param String $name
  * @param array $arguments
  */
 public function __construct($controller, $name, $arguments = array())
 {
     /** -----------------------------------------
      * Fields
      * ----------------------------------------*/
     /** @var TextField $firstName */
     $firstName = TextField::create('FirstName');
     $firstName->setAttribute('placeholder', 'Enter your first name')->setAttribute('data-parsley-required-message', 'Please enter your <strong>First Name</strong>')->setCustomValidationMessage('Please enter your <strong>First Name</strong>');
     /** @var EmailField $email */
     $email = EmailField::create('Email');
     $email->setAttribute('placeholder', 'Enter your email address')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Email</strong>')->setCustomValidationMessage('Please enter your <strong>Email</strong>');
     /** @var PasswordField $password */
     $password = PasswordField::create('Password');
     $password->setAttribute('placeholder', 'Enter your password')->setCustomValidationMessage('Please enter your <strong>Password</strong>')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Password</strong>');
     $fields = FieldList::create($email, $password);
     /** -----------------------------------------
      * Actions
      * ----------------------------------------*/
     $actions = FieldList::create(FormAction::create('Register')->setTitle('Register')->addExtraClass('btn--primary'));
     /** -----------------------------------------
      * Validation
      * ----------------------------------------*/
     $required = RequiredFields::create('FirstName', 'Email', 'Password');
     /** @var Form $form */
     $form = Form::create($this, $name, $fields, $actions, $required);
     if ($formData = Session::get('FormInfo.Form_' . $name . '.data')) {
         $form->loadDataFrom($formData);
     }
     parent::__construct($controller, $name, $fields, $actions, $required);
     $this->setAttribute('data-parsley-validate', true);
     $this->addExtraClass('form form--registration');
 }
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:39,代码来源:RegistrationForm.php


示例5: __construct

 /**
  * EmailVerificationLoginForm is the same as MemberLoginForm with the following changes:
  *  - The code has been cleaned up.
  *  - A form action for users who have lost their verification email has been added.
  *
  * We add fields in the constructor so the form is generated when instantiated.
  *
  * @param Controller $controller The parent controller, necessary to create the appropriate form action tag.
  * @param string $name The method on the controller that will return this form object.
  * @param FieldList|FormField $fields All of the fields in the form - a {@link FieldList} of {@link FormField} objects.
  * @param FieldList|FormAction $actions All of the action buttons in the form - a {@link FieldList} of {@link FormAction} objects
  * @param bool $checkCurrentUser If set to TRUE, it will be checked if a the user is currently logged in, and if so, only a logout button will be rendered
  */
 function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
 {
     $email_field_label = singleton('Member')->fieldLabel(Member::config()->unique_identifier_field);
     $email_field = TextField::create('Email', $email_field_label, null, null, $this)->setAttribute('autofocus', 'autofocus');
     $password_field = PasswordField::create('Password', _t('Member.PASSWORD', 'Password'));
     $authentication_method_field = HiddenField::create('AuthenticationMethod', null, $this->authenticator_class, $this);
     $remember_me_field = CheckboxField::create('Remember', 'Remember me next time?', true);
     if ($checkCurrentUser && Member::currentUser() && Member::logged_in_session_exists()) {
         $fields = FieldList::create($authentication_method_field);
         $actions = FieldList::create(FormAction::create('logout', _t('Member.BUTTONLOGINOTHER', "Log in as someone else")));
     } else {
         if (!$fields) {
             $fields = FieldList::create($authentication_method_field, $email_field, $password_field);
             if (Security::config()->remember_username) {
                 $email_field->setValue(Session::get('SessionForms.MemberLoginForm.Email'));
             } else {
                 // Some browsers won't respect this attribute unless it's added to the form
                 $this->setAttribute('autocomplete', 'off');
                 $email_field->setAttribute('autocomplete', 'off');
             }
         }
         if (!$actions) {
             $actions = FieldList::create(FormAction::create('doLogin', _t('Member.BUTTONLOGIN', "Log in")), new LiteralField('forgotPassword', '<p id="ForgotPassword"><a href="Security/lostpassword">' . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>'), new LiteralField('resendEmail', '<p id="ResendEmail"><a href="Security/verify-email">' . _t('MemberEmailVerification.BUTTONLOSTVERIFICATIONEMAIL', "I've lost my verification email") . '</a></p>'));
         }
     }
     if (isset($_REQUEST['BackURL'])) {
         $fields->push(HiddenField::create('BackURL', 'BackURL', $_REQUEST['BackURL']));
     }
     // Reduce attack surface by enforcing POST requests
     $this->setFormMethod('POST', true);
     parent::__construct($controller, $name, $fields, $actions);
     $this->setValidator(RequiredFields::create('Email', 'Password'));
 }
开发者ID:jordanmkoncz,项目名称:silverstripe-memberemailverification,代码行数:46,代码来源:EmailVerificationLoginForm.php


示例6: __construct

 /**
  * @param Controller $controller
  * @param String $name
  * @param array $arguments
  */
 public function __construct($controller, $name, $arguments = array())
 {
     /** =========================================
          * @var EmailField $emailField
          * @var TextField $nameField
          * @var FormAction $submit
          * @var Form $form
         ===========================================*/
     /** -----------------------------------------
      * Fields
      * ----------------------------------------*/
     $emailField = EmailField::create('Email', 'Email Address');
     $emailField->addExtraClass('form-control')->setAttribute('placeholder', 'Email')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Email</strong>')->setCustomValidationMessage('Please enter your <strong>Email</strong>');
     $nameField = TextField::create('Name', 'Name');
     $nameField->setAttribute('placeholder', 'Name')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Name</strong>')->setCustomValidationMessage('Please enter your <strong>Name</strong>');
     $fields = FieldList::create($nameField, $emailField);
     /** -----------------------------------------
      * Actions
      * ----------------------------------------*/
     $submit = FormAction::create('Subscribe');
     $submit->setTitle('SIGN UP')->addExtraClass('button');
     $actions = FieldList::create($submit);
     /** -----------------------------------------
      * Validation
      * ----------------------------------------*/
     $required = RequiredFields::create('Name', 'Email');
     $form = Form::create($this, $name, $fields, $actions, $required);
     if ($formData = Session::get('FormInfo.Form_' . $name . '.data')) {
         $form->loadDataFrom($formData);
     }
     parent::__construct($controller, $name, $fields, $actions, $required);
     $this->setAttribute('data-parsley-validate', true);
     $this->addExtraClass('form');
 }
开发者ID:toastnz,项目名称:quicksilver,代码行数:39,代码来源:SubscriptionForm.php


示例7: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Safety Check ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('completed' => array('required' => true, 'regex' => '/^(0|1)$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update safety check");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:SafetyCheck.php


示例8: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Customer ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('firstname' => array('regex' => '/^.{1,30}$/'), 'lastname' => array('regex' => '/^.{1,30}$/'), 'address' => array('regex' => '/^.{1,100}$/'), 'city' => array('regex' => '/^.{1,50}$/'), 'state' => array('regex' => '/^.{1,20}$/'), 'postcode' => array('regex' => '/^\\d{4}$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update customer");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Customer.php


示例9: createValidator

 public function createValidator()
 {
     $validator = RequiredFields::create('PaymentMethod');
     $this->extend('updateValidator', $validator);
     $validator->setForm($this);
     return $validator;
 }
开发者ID:vinstah,项目名称:body,代码行数:7,代码来源:RepayForm.php


示例10: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Item ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('invoice' => array('regex' => '/^\\d+$/'), 'amount' => array('regex' => '/^([\\d]*\\.[\\d]+|[\\d]+)$/'), 'comment' => array(), 'date' => array('regex' => '/^2\\d{3}\\-[01]\\d\\-[0-3]\\d$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update payment");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Payment.php


示例11: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Item ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('description' => array('regex' => '/^.{1,100}$/'), 'defaultCost' => array('regex' => '/^[-+]?([\\d]*\\.[\\d]+|[\\d]+)$/'), 'defaultQuantity' => array('regex' => '/^[-+]?([\\d]*\\.[\\d]+|[\\d]+)$/'), 'comment' => array('regex' => '/^(0|1)$/'), 'active' => array('regex' => '/^(0|1)$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update item");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Item.php


示例12: put

 public function put($customerId = null, $carId = null)
 {
     if (empty($carId)) {
         new Error("Car ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('owner' => array('regex' => '/^\\d+$/'), 'make' => array('regex' => '/^.{1,100}$/'), 'model' => array('regex' => '/^.{1,100}$/'), 'registration' => array('regex' => '/^[A-Z0-9]{1,6}$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $carId)) {
             $this->get(array_key_exists('owner', $fields) ? $fields['owner'] : $customerId, $carId);
         } else {
             new Error("Could not update customer");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Car.php


示例13: __construct

 /**
  * @param Controller $controller
  * @param String $name
  * @param array $arguments
  */
 public function __construct($controller, $name, $arguments = array())
 {
     /** -----------------------------------------
      * Fields
      * ----------------------------------------*/
     /** @var EmailField $email */
     $email = EmailField::create('Email', 'Email Address');
     $email->addExtraClass('form-control')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Email</strong>')->setCustomValidationMessage('Please enter your <strong>Email</strong>');
     $fields = FieldList::create($email);
     /** -----------------------------------------
      * Actions
      * ----------------------------------------*/
     $actions = FieldList::create(FormAction::create('Subscribe')->setTitle('Subscribe')->addExtraClass('btn btn-primary'));
     /** -----------------------------------------
      * Validation
      * ----------------------------------------*/
     $required = RequiredFields::create('Email');
     /** @var Form $form */
     $form = Form::create($this, $name, $fields, $actions, $required);
     if ($formData = Session::get('FormInfo.Form_' . $name . '.data')) {
         $form->loadDataFrom($formData);
     }
     parent::__construct($controller, $name, $fields, $actions, $required);
     $this->setAttribute('data-parsley-validate', true);
     $this->addExtraClass('form');
 }
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:31,代码来源:SubscriptionForm.php


示例14: __construct

 public function __construct($controller, $name = "PostagePaymentForm")
 {
     // Get delivery data and postage areas from session
     $delivery_data = Session::get("Commerce.DeliveryDetailsForm.data");
     $country = $delivery_data['DeliveryCountry'];
     $postcode = $delivery_data['DeliveryPostCode'];
     $postage_areas = $controller->getPostageAreas($country, $postcode);
     // Loop through all postage areas and generate a new list
     $postage_array = array();
     foreach ($postage_areas as $area) {
         $area_currency = new Currency("Cost");
         $area_currency->setValue($area->Cost);
         $postage_array[$area->ID] = $area->Title . " (" . $area_currency->Nice() . ")";
     }
     $postage_id = Session::get('Commerce.PostageID') ? Session::get('Commerce.PostageID') : 0;
     // Setup postage fields
     $postage_field = CompositeField::create(HeaderField::create("PostageHeader", _t('Commerce.Postage', "Postage")), OptionsetField::create("PostageID", _t('Commerce.PostageSelection', 'Please select your prefered postage'), $postage_array)->setValue($postage_id))->setName("PostageFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
     // Get available payment methods and setup payment
     $payment_methods = SiteConfig::current_site_config()->PaymentMethods();
     // Deal with payment methods
     if ($payment_methods->exists()) {
         $payment_map = $payment_methods->map('ID', 'Label');
         $payment_value = $payment_methods->filter('Default', 1)->first()->ID;
     } else {
         $payment_map = array();
         $payment_value = 0;
     }
     $payment_field = CompositeField::create(HeaderField::create('PaymentHeading', _t('Commerce.Payment', 'Payment'), 2), OptionsetField::create('PaymentMethodID', _t('Commerce.PaymentSelection', 'Please choose how you would like to pay'), $payment_map, $payment_value))->setName("PaymentFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
     $fields = FieldList::create(CompositeField::create($postage_field, $payment_field)->setName("PostagePaymentFields")->addExtraClass("units-row")->addExtraClass("line"));
     $back_url = $controller->Link("billing");
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('doContinue', _t('Commerce.PaymentDetails', 'Enter Payment Details'))->addExtraClass('btn')->addExtraClass('commerce-action-next')->addExtraClass('btn-green'));
     $validator = RequiredFields::create(array("PostageID", "PaymentMethod"));
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:34,代码来源:PostagePaymentForm.php


示例15: PersonalRegisterForm

 public function PersonalRegisterForm()
 {
     $fields = FieldList::create(array(EmailField::create('Email', '电子邮件'), ConfirmedPasswordField::create('Password', '密码'), TextField::create('FullName', '姓名'), TextField::create('IDCard', '身份证号码'), TextField::create('Phone', '联系电话'), DropdownField::create('OrganizationID', '所属单位名称', Organization::get()->map('ID', 'company_name'))->setEmptyString('请选择')));
     $actions = FieldList::create(array(FormAction::create('doRegisterPersonal', '提交')));
     $required = RequiredFields::create(array('Email', 'Password', 'FullName', 'IDCard', 'Phone', 'OrganizationID'));
     $form = new Form($this, __FUNCTION__, $fields, $actions, $required);
     return $form;
 }
开发者ID:jallen0927,项目名称:lytech,代码行数:8,代码来源:RegisterPage_Controller.php


示例16: TypoForm

 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-typography,代码行数:8,代码来源:Typography.php


示例17: ApplicationForm

 public function ApplicationForm()
 {
     $fields = FieldList::create(TextField::create('Name', 'Full name'), EmailField::create('Email', 'Email address'), PhoneNumberField::create('Phone', 'Contact Phone number'), DropdownField::create('JobID', 'Which job are you applying for?', $this->AvailableJobs()->map('ID', 'Title'))->setEmptyString('(Select)'), TextareaField::create('Application', 'Enter your experience and skills'));
     $actions = FieldList::create(FormAction::create('processApplication', 'Apply'));
     $validator = RequiredFields::create(array('Name', 'Email', 'Phone', 'JobID', 'Application'));
     $form = Form::create($this, 'ApplicationForm', $fields, $actions, $validator);
     return $form;
 }
开发者ID:Fr3dj,项目名称:training,代码行数:8,代码来源:JobPage.php


示例18: CommentForm

 public function CommentForm()
 {
     $form = Form::create($this, __FUNCTION__, FieldList::create(TextField::create('Name', '')->setAttribute('placeholder', 'Name*')->addExtraClass('form-control'), EmailField::create('Email', '')->setAttribute('placeholder', 'Email*')->addExtraClass('form-control'), TextareaField::create('Comment', '')->setAttribute('placeholder', 'Comment*')->addExtraClass('form-control')), FieldList::create(FormAction::create('handleComment', 'Post Comment')->setUseButtonTag(true)->addExtraClass('btn btn-default-color btn-lg')), RequiredFields::create('Name', 'Email', 'Comment'));
     $form->addExtraClass('form-style');
     $data = Session::get("FormData.{$form->getName()}.data");
     //using the tirnary operator if $data exist...
     return $data ? $form->loadDataFrom($data) : $form;
 }
开发者ID:lestercomia,项目名称:onering,代码行数:8,代码来源:ArticlePage.php


示例19: SetPasswordForm

 /**
  * Creates a form to set a password
  *
  * @return  Form
  */
 public function SetPasswordForm()
 {
     if (!Member::currentUser()) {
         return false;
     }
     $form = Form::create($this->owner, FieldList::create(PasswordField::create('Password', 'Password'), PasswordField::Create('Password_confirm', 'Confirm password'), HiddenField::create('BackURL', '', $this->owner->requestVar('BackURL'))), FieldList::create(FormAction::create('doSetPassword', 'Set my password')), RequiredFields::create('Password', 'Password_confirm'));
     return $form;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:13,代码来源:MemberTokenAuthenticator.php


示例20: getCMSValidator

 /**
  * Set the required form fields for this gateway, taking those
  * defined in Gateway in to account.
  */
 public static function getCMSValidator()
 {
     //Get required fields from Gateway DataObject.
     $parent_required = is_array(parent::getCMSValidator()) ? parent::getCMSValidator() : array();
     //Specify our own required fields.
     $required = array("EmailAddress", "PDTToken");
     //Return the required fields.
     return RequiredFields::create(array_merge($parent_required, $required));
 }
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:13,代码来源:Gateway_PayPal.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Requirement类代码示例发布时间:2022-05-23
下一篇:
PHP Requests类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap