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


PHP FormAction类代码示例

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


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

示例1: __construct

 /**
  * Returns an instance of this class
  *
  * @param Controller $controller
  * @param string $name
  */
 public function __construct($controller, $name)
 {
     $fields = new FieldList(array(new HiddenField('AuthenticationMethod', null, $this->authenticator_class)));
     $actions = new FieldList(array(FormAction::create('redirectToRealMe', _t('RealMeLoginForm.LOGINBUTTON', 'LoginAction'))->setUseButtonTag(true)->setButtonContent('<span class="realme_button_padding">Login or register with RealMe<span class="realme_icon_new_window"></span> <span class="realme_icon_padlock"></span>')->setAttribute('class', 'realme_button')));
     // Taken from MemberLoginForm
     if (isset($_REQUEST['BackURL'])) {
         $backURL = $_REQUEST['BackURL'];
     } elseif (Session::get('BackURL')) {
         $backURL = Session::get('BackURL');
     }
     if (isset($backURL)) {
         // Ensure that $backURL isn't redirecting us back to login form or a RealMe authentication page
         if (strpos($backURL, 'Security/login') === false && strpos($backURL, 'Security/realme') === false) {
             $fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
         }
     }
     // optionally include requirements {@see /realme/_config/config.yml}
     if ($this->config()->include_jquery) {
         Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     }
     if ($this->config()->include_javascript) {
         Requirements::javascript(REALME_MODULE_PATH . "/javascript/realme.js");
     }
     if ($this->config()->include_css) {
         Requirements::css(REALME_MODULE_PATH . "/css/realme.css");
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-realme,代码行数:34,代码来源:RealMeLoginForm.php

示例2: testGetField

 public function testGetField()
 {
     $formAction = new FormAction('test');
     $this->assertContains('type="submit"', $formAction->getAttributesHTML());
     $formAction->setAttribute('src', 'file.png');
     $this->assertContains('type="image"', $formAction->getAttributesHTML());
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:7,代码来源:FormActionTest.php

示例3: __construct

    public function __construct($controller, $name, $fields = null, $actions = null, $validator = null)
    {
        if (!$fields) {
            $helpHtml = _t('GroupImportForm.Help1', '<p>Import one or more groups in <em>CSV</em> format (comma-separated values).' . ' <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>');
            $helpHtml .= _t('GroupImportForm.Help2', '<div class="advanced">
	<h4>Advanced usage</h4>
	<ul>
	<li>Allowed columns: <em>%s</em></li>
	<li>Existing groups are matched by their unique <em>Code</em> value, and updated with any new values from the 
	imported file</li>
	<li>Group hierarchies can be created by using a <em>ParentCode</em> column.</li>
	<li>Permission codes can be assigned by the <em>PermissionCode</em> column. Existing permission codes are not
	cleared.</li>
	</ul>
</div>');
            $importer = new GroupCsvBulkLoader();
            $importSpec = $importer->getImportSpec();
            $helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields'])));
            $fields = new FieldList(new LiteralField('Help', $helpHtml), $fileField = new FileField('CsvFile', _t('SecurityAdmin_MemberImportForm.FileFieldLabel', 'CSV File <small>(Allowed extensions: *.csv)</small>')));
            $fileField->getValidator()->setAllowedExtensions(array('csv'));
        }
        if (!$actions) {
            $action = new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import from CSV'));
            $action->addExtraClass('ss-ui-button');
            $actions = new FieldList($action);
        }
        if (!$validator) {
            $validator = new RequiredFields('CsvFile');
        }
        parent::__construct($controller, $name, $fields, $actions, $validator);
        $this->addExtraClass('cms');
        $this->addExtraClass('import-form');
    }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:33,代码来源:GroupImportForm.php

示例4: TrialSignupForm

 function TrialSignupForm()
 {
     $cardType = array("visa" => "<img src='themes/attwiz/images/visa.png' height=30px></img>", "mc" => "<img src='themes/attwiz/images/mastercard.jpeg' height=30px></img>", "amex" => "<img src='themes/attwiz/images/ae.jpeg' height=30px></img>", "discover" => "<img src='themes/attwiz/images/discover.jpeg' height=30px></img>");
     $monthArray = array();
     for ($i = 1; $i <= 12; $i++) {
         $monthArray[$i] = date('F', mktime(0, 0, 0, $i));
     }
     $yearArray = array();
     $currentYear = date('Y');
     for ($i = 0; $i <= 10; $i++) {
         $yearArray[$currentYear + $i] = $currentYear + $i;
     }
     $trialExpiryDate = date('F-j-Y', mktime(0, 0, 0, date('n') + 1, date('j'), date('Y')));
     $subscriptionInfo = "<div id='SubscriptionInfo'><h2>Post-Trial Subscription Selection</h2>\n\t    <p>Your 10 heatmaps will expire on {$trialExpiryDate}, at which time your account \n\t    will be replenished with a new allocation of heatmap credits according to the \n\t    subscription level you choose below. You may cancel your subscription any time \n\t    before your trial period ends and your  credit card will only be charged 1 dollar.</p></div>";
     $subscriptionType = array("1" => "Bronze - (10 heatmaps for \$27.00 / month)", "2" => "Silver - (50 heatmaps for \$97.00 / month)", "3" => "Gold - (200 heatmaps for \$197.00 / month)");
     $whatsThis = '<span id="WhatsThis"><a id="WhatsThisImage" href="themes/attwiz/images/cvv.jpg" title="What\'s this?">What\'s this?</a></span>';
     $fields = new FieldList(new TextField('FirstName', 'First Name'), new TextField('LastName', 'Last Name'), new TextField('Company', 'Company(optional)'), new TextField('StreetAddress1', 'Street Address1'), new TextField('StreetAddress2', 'Street Address2(optional)'), new TextField('City', 'City'), new TextField('State', 'State/Province'), new TextField('PostalCode', 'Zip/Poatal Code'), new CountryDropdownField('Country'), new OptionsetField('CreditCardType', 'Credit Card Type', $cardType, 'visa'), new TextField('NameOnCard', 'Name On Card'), new NumericField('CreditCardNumber', 'Credit Card Number'), new PasswordField('CVVCode', 'Security/CVV Code'), new LiteralField('WhatIsThis', $whatsThis), new DropdownField('ExpirationMonth', 'Expiration Date', $monthArray), new DropdownField('ExpirationYear', '', $yearArray), new LiteralField('SubscriptionInfo', $subscriptionInfo), new OptionsetField('SubscriptionType', '', $subscriptionType, '1'), new CheckboxField('Agreement', ' I understand that this is a recurring subscription and I will be billed monthly unless I cancel.'));
     // Create action
     $actions = new FieldList($submit = new FormAction('doSignup', 'Start Trial'));
     $submit->setAttribute('src', 'themes/attwiz/images/button_startmytrialnow.gif');
     // Create action
     $validator = new RequiredFields('FirstName', 'LastName', 'StreetAddress1', 'City', 'State', 'PoatalCode', 'Country', 'CreditCardType', 'NameOnCard', 'CreditCardNumber', 'CVVCode', 'ExpirationMonth', 'ExpirationYear', 'SubscriptionInfo', 'SubscriptionType');
     $validator = null;
     $form = new Form($this, 'TrialSignupForm', $fields, $actions, $validator);
     $data = Session::get("FormInfo.Form_TrialSignupForm.data");
     if (is_array($data)) {
         $form->loadDataFrom($data);
     }
     return $form;
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:30,代码来源:TrialSignup.php

示例5: getEditForm

 function getEditForm($id = null)
 {
     $form = parent::getEditForm($id);
     if (!$id) {
         $id = $this->currentPageID();
     }
     if ($id && is_numeric($id)) {
         $fields = $form->Fields();
         if ($fields->hasTabSet()) {
             $fields->findOrMakeTab('Root.Import', _t('Group.IMPORTTABTITLE', 'Import'));
             $fields->addFieldToTab('Root.Import', new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="400px" border="0"></iframe>', $this->Link('memberimport'))));
             if (Permission::check('APPLY_ROLES')) {
                 $fields->addFieldToTab('Root.Roles', new LiteralField('RolesAddEditLink', sprintf('<p class="add-role"><a href="%s">%s</a></p>', $this->Link('show/root'), _t('Group.RolesAddEditLink', 'Add/edit roles'))));
             }
         }
         $form->Actions()->insertBefore($actionAddMember = new FormAction('addmember', _t('SecurityAdmin.ADDMEMBER', 'Add Member')), 'action_save');
         $actionAddMember->setForm($form);
         // Filter permissions
         $permissionField = $form->Fields()->dataFieldByName('Permissions');
         if ($permissionField) {
             $permissionField->setHiddenPermissions(self::$hidden_permissions);
         }
     }
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:hamishcampbell,项目名称:silverstripe-cms,代码行数:26,代码来源:SecurityAdmin.php

示例6: PrepaidSignupForm

 function PrepaidSignupForm()
 {
     $cardType = array("visa" => "<img src='themes/attwiz/images/visa.png' height=30px></img>", "mc" => "<img src='themes/attwiz/images/mastercard.jpeg' height=30px></img>", "amex" => "<img src='themes/attwiz/images/ae.jpeg' height=30px></img>", "discover" => "<img src='themes/attwiz/images/discover.jpeg' height=30px></img>");
     $monthArray = array();
     for ($i = 1; $i <= 12; $i++) {
         $monthArray[$i] = date('F', mktime(0, 0, 0, $i));
     }
     $yearArray = array();
     $currentYear = date('Y');
     for ($i = 0; $i <= 10; $i++) {
         $yearArray[$currentYear + $i] = $currentYear + $i;
     }
     $trialExpiryDate = date('F-j-Y', mktime(0, 0, 0, date('n') + 1, date('j'), date('Y')));
     $price = Product::get()->byID(7)->Price;
     $shoppingCart = $this->renderWith('PrepaidShoppingCart', array('Price' => $price));
     $whatsThis = '<span id="WhatsThis"><a id="WhatsThisImage" href="themes/attwiz/images/cvv.jpg" title="What\'s this?">What\'s this?</a></span>';
     $fields = new FieldList(new LiteralField('SignupTitle', '<h2>Create Your Account</h2>'), new EmailField('Email', 'Email'), new ConfirmedPasswordField('Password', 'Password'), new LiteralField('BillingInfoTitle', '<h2>Billing Information</h2>'), new TextField('FirstName', 'First Name'), new TextField('LastName', 'Last Name'), new TextField('Company', 'Company(optional)'), new TextField('StreetAddress1', 'Street Address1'), new TextField('StreetAddress2', 'Street Address2(optional)'), new TextField('City', 'City'), new TextField('State', 'State/Province'), new TextField('PostalCode', 'Zip/Poatal Code'), new CountryDropdownField('Country'), new OptionsetField('CreditCardType', 'Credit Card Type', $cardType, 'visa'), new TextField('NameOnCard', 'Name On Card'), new TextField('CreditCardNumber', 'Credit Card Number'), new PasswordField('CVVCode', 'Security/CVV Code'), new LiteralField('WhatIsThis', $whatsThis), new DropdownField('ExpirationMonth', 'Expiration Date', $monthArray), new DropdownField('ExpirationYear', '', $yearArray), new LiteralField('ShoppingCart', $shoppingCart), new HiddenField('Price', '', $price), new HiddenField('Quantity', '', 1));
     // Create action
     $actions = new FieldList($submit = new FormAction('doPrepaidSignup', ''));
     $submit->setAttribute('src', 'themes/attwiz/images/button_purchase.png');
     // Create action
     $validator = new RequiredFields('Email', 'Password', 'FirstName', 'LastName', 'StreetAddress1', 'City', 'State', 'PoatalCode', 'Country', 'CreditCardType', 'NameOnCard', 'CreditCardNumber', 'CVVCode', 'ExpirationMonth', 'ExpirationYear', 'OrderTotal');
     $validator = null;
     return new Form($this, 'PrepaidSignupForm', $fields, $actions, $validator);
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:25,代码来源:PrepaidSignup.php

示例7: MemberNonExpiringHeatmapsForm

 function MemberNonExpiringHeatmapsForm()
 {
     // Get current member
     $member = Member::currentUser();
     $isContactID = $member->ISContactID;
     $subscription = $this->getCurrentSubscription($member->ID);
     switch ($subscription->Product()->ID) {
         case 1:
             $productID = 4;
             break;
         case 2:
             $productID = 5;
             break;
         case 3:
             $productID = 6;
             break;
     }
     $price = Product::get()->byID($productID)->Price;
     $shoppingCart = $this->renderWith('PrepaidShoppingCart', array('Price' => $price));
     // Get existing credit card ID
     $creditCard = $this->getCurrentCreditCard($member->ID);
     if (!$creditCard) {
         $this->setMessage('Error', 'Please update your credit card first.');
         return $this->redirect('/account-settings/#tabs-2');
     }
     $fields = new FieldList(new HiddenField('FirstName', 'First Name', $member->FirstName), new HiddenField('LastName', 'Last Name', $member->Surname), new HiddenField('Company', 'Company(optional)', $creditCard->Company), new HiddenField('StreetAddress1', 'Street Address1', $creditCard->StreetAddress1), new HiddenField('StreetAddress2', 'Street Address2(optional)', $creditCard->StreetAddress2), new HiddenField('City', 'City', $creditCard->City), new HiddenField('State', 'State/Province', $creditCard->State), new HiddenField('PostalCode', 'Zip/Poatal Code', $creditCard->PostalCode), new HiddenField('Country', 'Country', $creditCard->Country), new HiddenField('CreditCardType', 'Credit Card Type', $creditCard->CreditCardType), new HiddenField('NameOnCard', 'Name On Card', $creditCard->NameOnCard), new HiddenField('CreditCardNumber', 'Credit Card Number', $creditCard->CreditCardNumber), new HiddenField('CVVCode', 'Security/CVV Code', $creditCard->CreditCardCVV), new HiddenField('ExpirationMonth', 'Expiration Date', $creditCard->ExpiryMonth), new HiddenField('ExpirationYear', '', $creditCard->ExpiryYear), new LiteralField('ShoppingCart', $shoppingCart), new HiddenField('ProductID', '', $productID), new HiddenField('Price', '', $price), new HiddenField('Quantity', '', 1));
     // Create action
     $actions = new FieldList($submit = new FormAction('doPurchase', 'Purchase Heatmaps'));
     $submit->setAttribute('src', 'themes/attwiz/images/button_purchase.png');
     // Create action
     $validator = new RequiredFields('FirstName', 'LastName', 'StreetAddress1', 'City', 'State', 'PoatalCode', 'Country', 'CreditCardType', 'NameOnCard', 'CreditCardNumber', 'CVVCode', 'ExpirationMonth', 'ExpirationYear');
     return new Form($this, 'MemberNonExpiringHeatmapsForm', $fields, $actions, $validator);
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:33,代码来源:MemberNonExpiringHeatmaps.php

示例8: update_cms_actions

 /**
  * @param FieldSet $actions
  * @parma SiteTree $page
  */
 public static function update_cms_actions(&$actions, $page)
 {
     $openRequest = $page->OpenWorkflowRequest();
     // if user doesn't have publish rights
     if (!$page->canPublish() || $openRequest) {
         // authors shouldn't be able to revert, as this republishes the page.
         // they should rather change the page and re-request publication
         $actions->removeByName('action_revert');
     }
     // Remove the one click publish if they are not an admin/workflow admin.
     if (self::$force_publishers_to_use_workflow && !Permission::checkMember(Member::currentUser(), 'IS_WORKFLOW_ADMIN')) {
         $actions->removeByName('action_publish');
     }
     // Remove the save & publish button if you don't have edit rights
     if (!$page->canEdit()) {
         $actions->removeByName('action_publish');
     }
     $liveVersion = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree_Live\".\"ID\" = {$page->ID}");
     if ($liveVersion && $liveVersion->ExpiryDate != null && $liveVersion->ExpiryDate != '0000-00-00 00:00:00') {
         if ($page->canApprove()) {
             $actions->push(new FormAction('cms_cancelexpiry', _t('WorkflowPublicationRequest.BUTTONCANCELEXPIRY', 'Cancel expiry')));
         }
     }
     // Optional method
     $isPublishable = $page->hasMethod('isPublishable') ? $page->isPublishable() : true;
     if (!$openRequest && $page->canEdit() && $isPublishable && $page->stagesDiffer('Stage', 'Live') && ($page->Version > 1 || $page->Title != "New Page") && !$page->IsDeletedFromStage && (!$page->canPublish() || self::$publisher_can_create_wf_requests)) {
         $actions->push($requestPublicationAction = new FormAction('cms_requestpublication', _t('SiteTreeCMSWorkflow.BUTTONREQUESTPUBLICATION', 'Request Publication')));
         // don't allow creation of a second request by another author
         if (!self::can_create(null, $page)) {
             $actions->makeFieldReadonly($requestPublicationAction->Name());
         }
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:37,代码来源:WorkflowPublicationRequest.php

示例9: __construct

 function __construct($controller, $name)
 {
     $fields = new FieldList(array($t1 = new TextField('ExternalOrderId', 'Eventbrite Order #'), $checkbox = new CheckboxField('SharedContactInfo', 'Allow to share contact info?')));
     $t1->setAttribute('placeholder', 'Enter your Eventbrite order #');
     $t1->addExtraClass('event-brite-order-number');
     $attendees = Session::get('attendees');
     if (count($attendees) > 0) {
         $t1->setValue(Session::get('ExternalOrderId'));
         $t1->setReadonly(true);
         $checkbox->setValue(intval(Session::get('SharedContactInfo')) === 1);
         $fields->add(new LiteralField('ctrl1', 'Current Order has following registered attendees, please select one:'));
         $options = array();
         foreach ($attendees as $attendee) {
             $ticket_external_id = intval($attendee['ticket_class_id']);
             $ticket_type = SummitTicketType::get()->filter('ExternalId', $ticket_external_id)->first();
             if (is_null($ticket_type)) {
                 continue;
             }
             $options[$attendee['id']] = $attendee['profile']['name'] . ' (' . $ticket_type->Name . ')';
         }
         $attendees_ctrl = new OptionSetField('SelectedAttendee', '', $options);
         $fields->add($attendees_ctrl);
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn_clear = new FormAction('clearSummitAttendeeInfo', 'Clear'), $btn = new FormAction('saveSummitAttendeeInfo', 'Done'));
         $btn->addExtraClass('btn btn-default active');
         $btn_clear->addExtraClass('btn btn-danger active');
     } else {
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn = new FormAction('saveSummitAttendeeInfo', 'Get Order'));
         $btn->addExtraClass('btn btn-default active');
     }
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:35,代码来源:SummitAttendeeInfoForm.php

示例10: __construct

 public function __construct($controller, $name, $fields = null, $actions = null, $validator = null)
 {
     if (!$fields) {
         $helpHtml = _t('MemberImportForm.Help1', '<p>Import users in <em>CSV format</em> (comma-separated values).' . ' <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>');
         $helpHtml .= _t('MemberImportForm.Help2', '<div class="advanced">' . '<h4>Advanced usage</h4>' . '<ul>' . '<li>Allowed columns: <em>%s</em></li>' . '<li>Existing users are matched by their unique <em>Code</em> property, and updated with any new values from ' . 'the imported file.</li>' . '<li>Groups can be assigned by the <em>Groups</em> column. Groups are identified by their <em>Code</em> property, ' . 'multiple groups can be separated by comma. Existing group memberships are not cleared.</li>' . '</ul>' . '</div>');
         $importer = new MemberCsvBulkLoader();
         $importSpec = $importer->getImportSpec();
         $helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields'])));
         $fields = new FieldList(new LiteralField('Help', $helpHtml), $fileField = new FileField('CsvFile', _t('SecurityAdmin_MemberImportForm.FileFieldLabel', 'CSV File <small>(Allowed extensions: *.csv)</small>')));
         $fileField->getValidator()->setAllowedExtensions(array('csv'));
     }
     if (!$actions) {
         $action = new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import from CSV'));
         $action->addExtraClass('ss-ui-button');
         $actions = new FieldList($action);
     }
     if (!$validator) {
         $validator = new RequiredFields('CsvFile');
     }
     parent::__construct($controller, $name, $fields, $actions, $validator);
     Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js');
     $this->addExtraClass('cms');
     $this->addExtraClass('import-form');
 }
开发者ID:maent45,项目名称:redefine_renos,代码行数:25,代码来源:MemberImportForm.php

示例11: EditProfileForm

 /**
  * @return Form|SS_HTTPResponse
  */
 public function EditProfileForm()
 {
     if (!Member::currentUser()) {
         $this->setFlash(_t('EditProfilePage.LoginWarning', 'Please login to edit your profile'), 'warning');
         return $this->redirect(Director::absoluteBaseURL());
     }
     $firstName = new TextField('FirstName');
     $firstName->setAttribute('placeholder', _t('EditProfilePage.FirstNamePlaceholder', 'Enter your first name'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $surname = new TextField('Surname');
     $surname->setAttribute('placeholder', _t('EditProfilePage.SurnamePlaceholder', 'Enter your surname'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $email = new EmailField('Email');
     $email->setAttribute('placeholder', _t('EditProfilePage.EmailPlaceholder', 'Enter your email address'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $jobTitle = new TextField('JobTitle');
     $jobTitle->setAttribute('placeholder', _t('EditProfilePage.JobTitlePlaceholder', 'Enter your job title'))->addExtraClass('form-control');
     $website = new TextField('Website');
     $website->setAttribute('placeholder', _t('EditProfilePage.WebsitePlaceholder', 'Enter your website'))->addExtraClass('form-control');
     $blurb = new TextareaField('Blurb');
     $blurb->setAttribute('placeholder', _t('EditProfilePage.BlurbPlaceholder', 'Enter your blurb'))->addExtraClass('form-control');
     $confirmPassword = new ConfirmedPasswordField('Password', _t('EditProfilePage.PasswordLabel', 'New Password'));
     $confirmPassword->canBeEmpty = true;
     $confirmPassword->setAttribute('placeholder', _t('EditProfilePage.PasswordPlaceholder', 'Enter your password'))->addExtraClass('form-control');
     $fields = new FieldList($firstName, $surname, $email, $jobTitle, $website, $blurb, $confirmPassword);
     $action = new FormAction('SaveProfile', _t('EditProfilePage.SaveProfileText', 'Update Profile'));
     $action->addExtraClass('btn btn-primary btn-lg');
     $actions = new FieldList($action);
     // Create action
     $validator = new RequiredFields('FirstName', 'Email');
     //Create form
     $form = new Form($this, 'EditProfileForm', $fields, $actions, $validator);
     //Populate the form with the current members data
     $Member = Member::currentUser();
     $form->loadDataFrom($Member->data());
     //Return the form
     return $form;
 }
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:38,代码来源:EditProfilePage.php

示例12: AgeGateForm

 public function AgeGateForm()
 {
     $enter = new FormAction("EnterAgeGate", "Enter");
     $enter->setUseButtonTag(true);
     $leave = new FormAction("LeaveAgeGate", "Leave");
     $leave->setUseButtonTag(true);
     $form = new Form($this, "AgeGateForm", new FieldList(new TextField("Month", "Month", "MM", 2), new TextField("Day", "Day", "DD", 2), new TextField("Year", "Year", "YYYY", 4), new CheckboxField("itWillBecomeAMemory", "Remember Me")), new FieldList($enter, $leave));
     return $form;
 }
开发者ID:helpfulrobot,项目名称:moosylvania-silverstripe-age-gate,代码行数:9,代码来源:AgeGatePage.php

示例13: __construct

 function __construct($controller, $name)
 {
     $SearchField = new TextField('Search', 'Search');
     $fields = new FieldList($SearchField);
     $searchButton = new FormAction('doSearch', 'Search');
     $searchButton->addExtraClass('button');
     $actions = new FieldList($searchButton);
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:9,代码来源:PresentationVotingSearchForm.php

示例14: Form

 /**
  * This form is exactly like the CMS form.  It gives us an opportunity to test the fields outside of the CMS context
  */
 function Form()
 {
     $fields = $this->getCMSFields();
     $actions = new FieldList(new FormAction("save", "Save"), $gohome = new FormAction("gohome", "Go home"));
     $gohome->setAttribute('src', 'frameworktest/images/test-button.png');
     $form = new Form($this, "Form", $fields, $actions);
     $form->loadDataFrom($this->dataRecord);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-frameworktest,代码行数:12,代码来源:TestPage.php

示例15: __construct

 function __construct($controller, $name)
 {
     $FeedbackField = new TextareaField('Content', 'My Feedback About This Page');
     $fields = new FieldList($FeedbackField);
     $tellUsButton = new FormAction('submitFeedback', 'Tell Us');
     $tellUsButton->addExtraClass('button');
     $actions = new FieldList($tellUsButton);
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:9,代码来源:FeedbackForm.php


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