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


PHP TextField类代码示例

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


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

示例1: __construct

    function __construct($controller, $name)
    {
        $Name = new TextField('Name', 'Your name');
        $Phone = new TextField('Phone', 'Your phone number');
        $Email = new TextField('Email', 'Your email');
        $Subject = new TextField('Subject', 'Subject');
        $Message = new TextareaField('Message', 'Your message', '10', '45');
        $Name->addExtraClass('Required');
        $Email->addExtraClass('Required');
        $Message->addExtraClass('Required');
        $messageFields = new CompositeField($Name, $Phone, $Email, $Subject, $Message);
        $fields = new FieldSet($messageFields);
        $actions = new FieldSet(new FormAction('processMessage', 'send'));
        Requirements::customScript('
			jQuery(document).ready(function() {
				
				jQuery("#ContactForm_ContactForm_Name").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
				jQuery("#ContactForm_ContactForm_Email").addClass("validate[required,custom[email]] text-input");
				jQuery("#ContactForm_ContactForm_Message").addClass("validate[required,length[6,300]] text-input");
				
				jQuery("#ContactForm_ContactForm").validationEngine()
				
			});
		');
        parent::__construct($controller, $name, $fields, $actions);
    }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:26,代码来源:ContactForm.php

示例2: __construct

 public function __construct($name, $title = null, $value = null, $form = null)
 {
     $allowed_types = $this->stat('allowed_types');
     $field_types = $this->stat('field_types');
     if (empty($allowed_types)) {
         $allowed_types = array_keys($field_types);
     }
     $field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types));
     $field->setEmptyString('Please choose the Link Type');
     $this->composite_fields['Type'] = $field;
     foreach ($allowed_types as $type) {
         $def = $field_types[$type];
         $field_name = "{$name}[{$type}]";
         switch ($def['field']) {
             case 'TreeDropdownField':
                 $field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title');
                 break;
             default:
                 $field = new TextField($field_name, '');
                 break;
         }
         $field->setDescription($def['description']);
         $field->addExtraClass('FlexiLinkCompositeField');
         $this->composite_fields[$type] = $field;
     }
     $this->setForm($form);
     parent::__construct($name, $title, $value, $form);
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-flexilink,代码行数:28,代码来源:FlexiLinkField.php

示例3: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $type = new DropdownField('EventType', _t('ScoutDistrict.Events.TYPE', 'Type'), array('section-meeting' => _t('ScoutDistrict.Enum.SECTIONMEETING', 'Section Meeting'), 'leaders-meeting' => _t('ScoutDistrict.Enum.LEADERSMEETING', 'Leaders Meeting'), 'activity' => _t('ScoutDistrict.Enum.ACTIVITY', 'Activity'), 'fundraising' => _t('ScoutDistrict.Enum.FUNDRAISING', 'Fundraising'), 'committee' => _t('ScoutDistrict.Enum.COMMITTEE', 'Committee'), 'camp' => _t('ScoutDistrict.Enum.CAMP', 'Camp'), 'group' => _t('ScoutDistrict.Enum.GROUP', 'Group'), 'district' => _t('ScoutDistrict.Enum.DISTRICT', 'District'), 'training' => _t('ScoutDistrict.Enum.TRAINING', 'Training'), 'other' => _t('ScoutDistrict.Enum.OTHER', 'Other')));
     $type->setRightTitle(_t('ScoutDistrict.Events.TYPE_HELP', 'What Type of event is this'))->addExtraClass('help');
     $location = new TextField('EventLocation', _t('ScoutDistrict.Events.LOCATION', 'Location'));
     $location->setRightTitle(_t('ScoutDistrict.Events.LOCATION_HELP', 'Where is the event being held'))->addExtraClass('help');
     $latitude = new TextField('EventLatitude', _t('ScoutDistrict.Events.LATITUDE', 'Latitude'));
     $latitude->setRightTitle(_t('ScoutDistrict.Events.LATITUDE_HELP', 'Latitude of event Location'))->addExtraClass('help');
     $longitude = new TextField('EventLongitude', _t('ScoutDistrict.Events.LONGITUDE', 'Longitude'));
     $longitude->setRightTitle(_t('ScoutDistrict.Events.LONGITUDE_HELP', 'Longitude of event Location'))->addExtraClass('help');
     $bookingDetails = new TextareaField('EventBookingDetails', _t('ScoutDistrict.Events.BOOKINGDETAILS', 'Booking Details'));
     $bookingDetails->setRightTitle(_t('ScoutDistrict.Events.BOOKINGDETAILS_HELP', 'Details of how to book a place for the Event'))->addExtraClass('help');
     $bookingURL = new TextField('EventBookingURL', _t('ScoutDistrict.Events.BOOKINGURL', 'Booking URL'));
     $bookingURL->setRightTitle(_t('ScoutDistrict.Events.BOOKINGURL_HELP', 'The URL of an external site to book a place'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Scouts', array($type, $location, $latitude, $longitude, $bookingDetails, $bookingURL));
     $thumbnail = new UploadField('ThumbnailImage', _t('ScoutDistrict.Events.THUMBNAIL', 'Thumbnail Image'));
     $thumbnail->setFolderName('event/thumbnail');
     $thumbnail->setRightTitle(_t('ScoutDistrict.Events.THUMBNAIL_HELP', 'A small image for displaying in listing/aggregated content'))->addExtraClass('help');
     $image = new UploadField('Image', _t('ScoutDistrict.Events.IMAGE', 'Image'));
     $image->setFolderName('event/image');
     $image->setRightTitle(_t('ScoutDistrict.Events.IMAGE_HELP', 'A Larger image for displaying in event header'))->addExtraClass('help');
     $files = new UploadField('Files', _t('ScoutDistrict.Events.FILE', 'Files'));
     $files->setFolderName('event/file');
     $files->setRightTitle(_t('ScoutDistrict.Events.FILE_HELP', 'This can be a file containing information about the event or an application form, etc'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Files', array($thumbnail, $image, $files));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:phpboyscout-silverstripe-scouts,代码行数:27,代码来源:ScoutCalenderEventExtension.php

示例4: __construct

 public function __construct($opponentId)
 {
     parent::__construct('composeMessageForm');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $field = new HiddenField('uid');
     $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_new_message_' . $opponentId));
     $this->addElement($field);
     $field = new HiddenField('opponentId');
     $field->setValue($opponentId);
     $this->addElement($field);
     $field = new TextField('subject');
     $field->setInvitation(OW::getLanguage()->text('mailbox', 'subject'));
     $field->setHasInvitation(true);
     $field->setRequired();
     $this->addElement($field);
     $field = new Textarea('message');
     $field->setInvitation(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
     $field->setHasInvitation(true);
     $field->setRequired();
     $this->addElement($field);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $submit = new Submit('sendBtn');
     $submit->setId('sendBtn');
     $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $js = UTIL_JsGenerator::composeJsString('
         owForms["composeMessageForm"].bind( "submit", function( r )
         {
             $("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
         });');
         OW::getDocument()->addOnloadScript($js);
     }
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:35,代码来源:compose_message_form.php

示例5: 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

示例6: __construct

 /**
  * Class constructor
  */
 public function __construct($providerName)
 {
     parent::__construct('provider-config-form');
     $this->setAjax(true);
     $this->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OW.info(data.message);setTimeout(function(){location.reload();}, 1000);}else{OW.error(data.message);}}');
     $this->setAction(OW::getRouter()->urlForRoute('ynsocialconnect-admin-ajaxUpdateProfileQuestion'));
     $language = OW::getLanguage();
     $service = YNSOCIALCONNECT_BOL_ServicesService::getInstance();
     $questionDtoList = $service->getOWQuestionDtoList($providerName);
     $aliases = $service->findAliasList($providerName);
     $options = $service->getServiceFields($providerName);
     foreach ($questionDtoList as $question) {
         $new_element = new Selectbox('alias[' . $question->name . ']');
         foreach ($options as $option) {
             $new_element->addOption($option->name, $option->label);
         }
         $new_element->setValue(empty($aliases[$question->name]) ? '' : $aliases[$question->name]);
         $this->addElement($new_element);
     }
     $hidden = new TextField('providerName');
     $hidden->addAttribute('type', 'hidden');
     $hidden->setValue($providerName);
     $this->addElement($hidden);
     $submit = new Submit('edit');
     $submit->setValue($language->text('ynsocialconnect', 'save_btn_label'));
     $this->addElement($submit);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:30,代码来源:config_fields_form.php

示例7: getCompositeField

 /**
  * @return Comosite FieldSet with Categorys and Items
  */
 function getCompositeField()
 {
     //create new composite field group for each category
     $oCatFieldSet = new CompositeField();
     // Set the field group ID
     $oCatFieldSet->setID('Cat' . $this->ID);
     $oCatFieldSet->addExtraClass('category');
     //create new composite field group for each category
     $oCatField = new TextField($this->ID . '_' . $this->FieldName, $this->Title, null, null);
     $oCatField->addExtraClass('category-field');
     //Add Category Percentage Field to the Form
     $oCatFieldSet->push($oCatField);
     if ($this->Description) {
         $oCatDescField = new LiteralField($this->ID . '_Description', '<p class="category-field-desc">' . $this->Description . '</p>');
         $oCatDescField->addExtraClass('category-field');
         $oCatFieldSet->push($oCatDescField);
     }
     //Add item Composite Field to this Composite Field
     //now get all of the items matched with this category
     $oFormCategoryItems = self::FormCategoryItems();
     foreach ($oFormCategoryItems as $item) {
         $oCatFieldSet->push($item->getFormField());
     }
     return $oCatFieldSet;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:28,代码来源:FormCategory.php

示例8: __construct

 /**
  * Class constructor
  *
  */
 public function __construct($plugins)
 {
     parent::__construct('configForm');
     $language = OW::getLanguage();
     $values = OW::getConfig()->getValues('attachments');
     if ($plugins['video']) {
         $field = new CheckboxField('video_share');
         $field->setValue($values['video_share']);
         $this->addElement($field);
     }
     if ($plugins['links']) {
         $field = new CheckboxField('link_share');
         $field->setValue($values['link_share']);
         $this->addElement($field);
     }
     if ($plugins['photo']) {
         $field = new CheckboxField('photo_share');
         $field->setId('photo_share_check');
         $field->setValue($values['photo_share']);
         $this->addElement($field);
         $field = new TextField('photo_album_name');
         $field->setValue(OW::getLanguage()->text('attachments', 'default_photo_album_name'));
         $field->setRequired();
         $this->addElement($field);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('attachments', 'config_save_label'));
     $this->addElement($submit);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:34,代码来源:admin.php

示例9: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Contact Form settings
     $recipient_field = new EmailField('DefaultRecipient', 'Email recipient');
     $recipient_field->setDescription('Default email address to send submissions to.');
     $subject_field = new TextField('Subject', 'Email subject');
     $subject_field->setDescription('Subject for the email.');
     $default_from_field = new EmailField('DefaultFrom', 'Email from');
     $default_from_field->setDescription('Default from email address.');
     $fields->addFieldToTab('Root.ContactForm.Settings', $recipient_field);
     $fields->addFieldToTab('Root.ContactForm.Settings', $subject_field);
     $fields->addFieldToTab('Root.ContactForm.Settings', $default_from_field);
     // Contact Form fields
     $conf = GridFieldConfig_RelationEditor::create(10);
     $conf->addComponent(new GridFieldSortableRows('SortOrder'));
     $data_columns = $conf->getComponentByType('GridFieldDataColumns');
     $data_columns->setDisplayFields(array('Name' => 'Name', 'Type' => 'Type', 'requiredText' => 'Required'));
     $contact_form_fields = new GridField('Fields', 'Field', $this->ContactFields(), $conf);
     $fields->addFieldToTab('Root.ContactForm.Fields', $contact_form_fields);
     // Recipient map
     $contact_fields = array();
     foreach ($this->ContactFields() as $contact_field) {
         $contact_fields[$contact_field->Name] = $contact_field->Name;
     }
     $recipient_map_field_field = new DropdownField('RecipientMapField', 'Recipient Map Field', $contact_fields);
     $recipient_map_field_field->setDescription('Field used to map recipients.');
     $recipient_map_field = new TextareaField('RecipientMap', 'Recipient Map');
     $recipient_map_field->setDescription('Map field values to an email address (format: value:email address) one per line.');
     $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field_field);
     $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:chtombleson-silverstripe-streamline,代码行数:33,代码来源:StreamLineContactPage.php

示例10: index

 public function index($params = array())
 {
     $userService = BOL_UserService::getInstance();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('hotlist', 'admin_heading_settings'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('settingsForm');
     $settingsForm->setId('settingsForm');
     $expiration_time = new TextField('expiration_time');
     $expiration_time->setRequired();
     $expiration_time->setLabel($language->text('hotlist', 'label_expiration_time'));
     $expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400;
     $expiration_time->setValue($expiration_time_value);
     $settingsForm->addElement($expiration_time);
     $submit = new Submit('save');
     $submit->addAttribute('class', 'ow_ic_save');
     $submit->setValue($language->text('hotlist', 'label_save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400);
             OW::getFeedback()->info($language->text('hotlist', 'settings_saved'));
             $this->redirect();
         }
     }
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:28,代码来源:admin.php

示例11: getCMSFields

 public function getCMSFields()
 {
     //Fetch curret fields and store in Fields
     $fields = parent::getCMSFields();
     //Remove Fields
     $fields->removeFieldFromTab("Root.Main", array("SortOrder", "CalendarID", "Title", "Content", "StartDate", "StartTime", "EndDate", "EndTime", "Location"));
     //Event Title
     $Title = new TextField("Title", "Event Title");
     $Title->setRightTitle("Enter the event title. i.e. sports day.");
     //Start Date & Time
     $StartDate = new DateField("StartDate", "Start Date");
     $StartDate->setConfig('showcalendar', 1);
     $StartDate->setConfig('dateformat', 'dd/MM/YYYY');
     $StartTime = new TimeField("StartTime", "Start Time (Optional)");
     $StartTime->setConfig('use_strtotime', 1);
     //End Date & Time
     $EndDate = new DateField("EndDate", "End Date (Optional)");
     $EndDate->setConfig('showcalendar', 1);
     $EndDate->setConfig('dateformat', 'dd/MM/YYYY');
     $EndTime = new TimeField("EndTime", "End Time (Optional)");
     $StartTime->setConfig('use_strtotime', 1);
     //Location
     $Location = new AddressTextField("Location", "Event Location", "AIzaSyA-folYpPWGiFcpBZURJpf610nO6FJtqqQ");
     $Location->SetRightTitle("Optional. Begin typing and you will see address suggestions (Beta). Powered by Google.");
     $Location->addExtraClass("text");
     //Event Description
     $Description = new HTMLEditorField("Content", "Event Description");
     //Group Start and End Date & Time Fields
     $Times = FieldGroup::create($StartDate, $StartTime, $EndDate, $EndTime)->setTitle('Timings');
     //Add Fields to the CMS
     $fields->addFieldsToTab("Root.Main", array($Title, $Times, $Location, $Description));
     //Return Fields to the CMS
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:torindul-torindul-silverstripe-calendar,代码行数:34,代码来源:CalendarEvent.php

示例12: __construct

 public function __construct($configs, $features)
 {
     parent::__construct('MCOMPOSE_ConfigForm');
     $this->configs = $configs;
     $language = OW::getLanguage();
     $field = new TextField('max_users');
     $field->setRequired();
     $field->setValue($configs['max_users']);
     $this->addElement($field);
     if ($features["friends"]) {
         $field = new CheckboxField('friends_enabled');
         $field->setValue($configs['friends_enabled']);
         $this->addElement($field);
     }
     if ($features["groups"]) {
         $field = new CheckboxField('groups_enabled');
         $field->setValue($configs['groups_enabled']);
         $this->addElement($field);
     }
     if ($features["events"]) {
         $field = new CheckboxField('events_enabled');
         $field->setValue($configs['events_enabled']);
         $this->addElement($field);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('mcompose', 'admin_save_btn'));
     $this->addElement($submit);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:29,代码来源:admin.php

示例13: getGoogleSiteSearchForm

 /**
  * returns the form
  * @return Form
  */
 public function getGoogleSiteSearchForm($name = "GoogleSiteSearchForm")
 {
     $formIDinHTML = "Form_" . $name;
     if ($page = GoogleCustomSearchPage::get()->first()) {
         Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
         Requirements::javascript('googlecustomsearch/javascript/GoogleCustomSearch.js');
         $apiKey = Config::inst()->get("GoogleCustomSearchExt", "api_key");
         $cxKey = Config::inst()->get("GoogleCustomSearchExt", "cx_key");
         if ($apiKey && $cxKey) {
             Requirements::customScript("\n\t\t\t\t\t\tGoogleCustomSearch.apiKey = '" . $apiKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.cxKey = '" . $cxKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.formSelector = '#" . $formIDinHTML . "';\n\t\t\t\t\t\tGoogleCustomSearch.inputFieldSelector = '#" . $formIDinHTML . "_search';\n\t\t\t\t\t\tGoogleCustomSearch.resultsSelector = '#" . $formIDinHTML . "_Results';\n\t\t\t\t\t", "GoogleCustomSearchExt");
             $form = new Form($this->owner, 'GoogleSiteSearchForm', new FieldList($searchField = new TextField('search'), $resultField = new LiteralField($name . "_Results", "<div id=\"" . $formIDinHTML . "_Results\"></div>")), new FieldList(new FormAction('doSearch', _t("GoogleCustomSearchExt.GO", "Full Results"))));
             $form->setFormMethod('GET');
             if ($page = GoogleCustomSearchPage::get()->first()) {
                 $form->setFormAction($page->Link());
             }
             $form->disableSecurityToken();
             $form->loadDataFrom($_GET);
             $searchField->setAttribute("autocomplete", "off");
             $form->setAttribute("autocomplete", "off");
             return $form;
         } else {
             user_error("You must set an API Key and a CX key in your configs to use the Google Custom Search Form", E_USER_NOTICE);
         }
     } else {
         user_error("You must create a GoogleCustomSearchPage first.", E_USER_NOTICE);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-googlecustomsearch,代码行数:31,代码来源:GoogleCustomSearchExt.php

示例14: testRegexpPrice

 public function testRegexpPrice()
 {
     \Input::setPost('test_rgxp_price', 'foobar');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertTrue($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '20.00');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '20');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '-20');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '20.-');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:33,代码来源:IsotopeTest.php

示例15: __construct

 function __construct($controller, $name)
 {
     $org_field = null;
     $current_user = Member::currentUser();
     $current_affiliations = $current_user->getCurrentAffiliations();
     if (!$current_affiliations) {
         $org_field = new TextField('Organization', 'Your Organization Name');
     } else {
         if (count($current_affiliations) > 1) {
             $source = array();
             foreach ($current_affiliations as $a) {
                 $org = $a->Organization();
                 $source[$org->ID] = $org->Name;
             }
             $source['0'] = "-- New One --";
             $ddl = new DropdownField('OrgID', 'Your Organization', $source);
             $ddl->setEmptyString('-- Select Your Organization --');
             $org_field = new FieldGroup();
             $org_field->push($ddl);
             $org_field->push($txt = new TextField('Organization', ''));
             $txt->addExtraClass('new-org-name');
         } else {
             $org_field = new TextField('Organization', 'Your Organization Name', $current_user->getOrgName());
         }
     }
     $fields = new FieldList($org_field, new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextareaField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $country = new DropdownField('PrimaryCountry', 'Country', CountryCodes::$iso_3166_countryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CustomCheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options)));
     $org_it_activity->addExtraClass('hidden');
     $country->setEmptyString('-- Select One --');
     $nextButton = new FormAction('NextStep', '  Next Step  ');
     $actions = new FieldList($nextButton);
     $validator = new RequiredFields();
     Requirements::javascript('surveys/js/deployment_survey_yourorganization_form.js');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:34,代码来源:DeploymentSurveyYourOrganizationForm.php


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