本文整理汇总了PHP中TextField::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::setValue方法的具体用法?PHP TextField::setValue怎么用?PHP TextField::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValueFrom
public function setValueFrom(DataObjectInterface $do)
{
if ($do->StreetName) {
$this->streetNameField->setValue($do->StreetName);
}
if ($do->StreetNumber) {
$this->streetNumberField->setValue($do->StreetNumber);
}
}
示例2: testDefaultValueIsRespected
public function testDefaultValueIsRespected()
{
$field = new TextField('default_value', 0, 'default', array(), null);
$this->assertEquals('(default)', $field->getEscapedValue(), "Default Value is respected on null value");
$field->setValue('value');
$this->assertEquals('(value)', $field->getEscapedValue(), "Default Value is ignored if value not null");
$field->setValue('');
$this->assertEquals('(\\)', $field->getEscapedValue(), "Default Value is ignored if value is empty");
}
示例3: settings
public function settings()
{
$adminForm = new Form('adminForm');
$language = OW::getLanguage();
$config = OW::getConfig();
$element = new TextField('autoclick');
$element->setRequired(true);
$validator = new IntValidator(1);
$validator->setErrorMessage($language->text('autoviewmore', 'admin_invalid_number_error'));
$element->addValidator($validator);
$element->setLabel($language->text('autoviewmore', 'admin_auto_click'));
$element->setValue($config->getValue('autoviewmore', 'autoclick'));
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue($language->text('autoviewmore', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$config = OW::getConfig();
$config->saveConfig('autoviewmore', 'autoclick', $values['autoclick']);
OW::getFeedback()->info($language->text('autoviewmore', 'user_save_success'));
}
}
$this->addForm($adminForm);
}
示例4: setValue
public function setValue($value)
{
foreach ($this->getExtraFieldsInit() as $field) {
$field->setValue($value);
}
return parent::setValue($value);
}
示例5: __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);
}
示例6: __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);
}
示例7: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$field = new TextField('public_key');
$field->addValidator(new ConfigRequireValidator());
$this->addElement($field);
$field = new CheckboxField('billing_enabled');
$this->addElement($field);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
$promoUrl = new TextField('app_url');
$promoUrl->setRequired();
$promoUrl->addValidator(new UrlValidator());
$promoUrl->setLabel($language->text('skandroid', 'app_url_label'));
$promoUrl->setDescription($language->text('skandroid', 'app_url_desc'));
$promoUrl->setValue(OW::getConfig()->getValue('skandroid', 'app_url'));
$this->addElement($promoUrl);
$smartBanner = new CheckboxField('smart_banner');
$smartBanner->setLabel($language->text('skandroid', 'smart_banner_label'));
$smartBanner->setDescription($language->text('skandroid', 'smart_banner_desc'));
$smartBanner->setValue(OW::getConfig()->getValue('skandroid', 'smart_banner'));
$this->addElement($smartBanner);
}
示例8: __construct
public function __construct()
{
parent::__construct('payeer-config-form');
$language = OW::getLanguage();
$billingService = BOL_BillingService::getInstance();
$gwKey = BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY;
$element = new TextField('m_key');
$element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_key'));
$this->addElement($element);
$element = new TextField('m_shop');
$element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_shop'));
$this->addElement($element);
$element = new Selectbox('m_curr');
$element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_curr'))->setHasInvitation(false)->addOption('RUB', 'RUB')->addOption('usd', 'USD');
$this->addElement($element);
$element = new Selectbox('lang');
$element->setValue($billingService->getGatewayConfigValue($gwKey, 'lang'))->setHasInvitation(false)->addOption('ru', 'Русский')->addOption('en', 'English');
$this->addElement($element);
$element = new Selectbox('tabNum');
$element->setValue($billingService->getGatewayConfigValue($gwKey, 'tabNum'))->setHasInvitation(false)->addOption('1', 'Electronic Systems')->addOption('2', 'Cash / Bank Transfers')->addOption('3', 'Terminals')->addOption('4', 'SMS payments');
$this->addElement($element);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('billingpayeer', 'btn_save'));
$this->addElement($submit);
}
示例9: index
public function index()
{
$language = OW::getLanguage();
$billingService = BOL_BillingService::getInstance();
$adminForm = new Form('adminForm');
$element = new TextField('creditValue');
$element->setRequired(true);
$element->setLabel($language->text('billingcredits', 'admin_usd_credit_value'));
$element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc'));
$element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue'));
$validator = new FloatValidator(0.1);
$validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format'));
$element->addValidator($validator);
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue($language->text('billingcredits', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']);
OW::getFeedback()->info($language->text('billingcredits', 'user_save_success'));
}
}
$this->addForm($adminForm);
$this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
$this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
$this->setPageHeadingIconClass('ow_ic_app');
}
示例10: FieldList
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);
}
示例11: TextField
function __construct($controller, $name, $talkID)
{
// Email Address Field
$EmailAddressField = new TextField('Email', "Speaker's Email Address");
$formData = Session::get("FormInfo.Form_CallForSpeakersRegistrationForm.data");
if ($formData['Email']) {
$email = $formData['Email'];
} else {
$email = Member::currentUser()->Email;
}
$EmailAddressField->setValue($email);
// Talk ID
$TalkField = new HiddenField('TalkID', "TalkID", $talkID);
$fields = new FieldList($EmailAddressField, $TalkField);
$talk = NULL;
if ($talkID != NULL) {
// Look to see if the presentation has at least one speaker attached
$talkID = Convert::raw2sql($talkID);
$talk = Talk::get()->byID($talkID);
}
if ($talk && $talk->HasSpeaker()) {
$actions = new FieldList(new FormAction('addAction', 'Add New Speaker'), new FormAction('done', 'Done Editing Speakers'));
} else {
$actions = new FieldList(new FormAction('addAction', 'Add First Speaker'));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例12: __construct
/**
* Class constructor
*
*/
public function __construct($configs)
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$field = new RadioField('itunes_mode');
$field->setOptions(array("test" => $language->text("skadateios", "itunes_mode_test"), "live" => $language->text("skadateios", "itunes_mode_live")));
$field->setValue($configs["itunes_mode"]);
$this->addElement($field);
$field = new CheckboxField('billing_enabled');
$field->setValue($configs["billing_enabled"]);
$this->addElement($field);
$field = new TextField('itunes_secret');
$field->addValidator(new ConfigRequireValidator());
$field->setValue($configs["itunes_secret"]);
$this->addElement($field);
$promoUrl = new TextField('app_url');
$promoUrl->setRequired();
$promoUrl->addValidator(new UrlValidator());
$promoUrl->setLabel($language->text('skadateios', 'app_url_label'));
$promoUrl->setDescription($language->text('skadateios', 'app_url_desc'));
$promoUrl->setValue($configs['app_url']);
$this->addElement($promoUrl);
$smartBanner = new CheckboxField('smart_banner');
$smartBanner->setLabel($language->text('skadateios', 'smart_banner_label'));
$smartBanner->setDescription($language->text('skadateios', 'smart_banner_desc'));
$smartBanner->setValue($configs['smart_banner']);
$this->addElement($smartBanner);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
}
示例13: __construct
public function __construct($albumId)
{
parent::__construct('albumEditForm');
$album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
$this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
$this->setAjax(TRUE);
$this->setAjaxResetOnSuccess(FALSE);
$albumIdField = new HiddenField('album-id');
$albumIdField->setValue($album->id);
$albumIdField->setRequired();
$albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
$this->addElement($albumIdField);
$albumNameField = new TextField('albumName');
$albumNameField->setValue($album->name);
$albumNameField->setRequired();
if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
$albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(TRUE, NULL, $album->name));
}
$albumNameField->addAttribute('class', 'ow_photo_album_name_input');
$this->addElement($albumNameField);
$desc = new Textarea('desc');
$desc->setValue(!empty($album->description) ? $album->description : NULL);
$desc->setHasInvitation(TRUE);
$desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
$desc->addAttribute('class', 'ow_photo_album_description_textarea');
$this->addElement($desc);
}
示例14: __construct
public function __construct($conversationId, $opponentId)
{
parent::__construct('newMailMessageForm');
$this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
$field = new TextField('newMessageText');
$field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
$field->setId('newMessageText');
$this->addElement($field);
$field = new HiddenField('attachment');
$this->addElement($field);
$field = new HiddenField('conversationId');
$field->setValue($conversationId);
$this->addElement($field);
$field = new HiddenField('opponentId');
$field->setValue($opponentId);
$this->addElement($field);
$field = new HiddenField('uid');
$field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId));
$this->addElement($field);
$submit = new Submit('newMessageSendBtn');
$submit->setId('newMessageSendBtn');
$submit->setName('newMessageSendBtn');
$submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
$this->addElement($submit);
if (!OW::getRequest()->isAjax()) {
$js = UTIL_JsGenerator::composeJsString('
owForms["newMailMessageForm"].bind( "submit", function( r )
{
$("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
});');
OW::getDocument()->addOnloadScript($js);
}
$this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage'));
}
示例15: build
/**
* @param ISurveyStep $current_step
* @param ISurveyQuestionTemplate $question
* @param ISurveyAnswer $answer
* @return FormField
*/
public function build(ISurveyStep $current_step, ISurveyQuestionTemplate $question, ISurveyAnswer $answer)
{
$field = new TextField($question->name(), $question->label());
$field->setValue($question->initialValue());
if ($question->isReadOnly()) {
$field->setDisabled(true);
}
if ($question->isMandatory()) {
$field->setAttribute('data-rule-required', 'true');
}
if (!is_null($answer)) {
$field->setValue($answer->value());
}
$this->buildDependantRules($current_step, $question, $field);
return $field;
}