本文整理汇总了PHP中HiddenField::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP HiddenField::setValue方法的具体用法?PHP HiddenField::setValue怎么用?PHP HiddenField::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HiddenField
的用法示例。
在下文中一共展示了HiddenField::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param Controller $controller
* @param Job $job (optional)
*/
public function __construct($controller, $job = null)
{
if ($job) {
$fields = $job->getFields();
$required = $job->getValidator();
} else {
$fields = singleton('Job')->getFields();
$required = singleton('Job')->getValidator();
}
$fields->merge(new FieldList(new LiteralField('Conditions', $controller->TermsAndConditionsText), new HiddenField('BackURL', '', $controller->Link('thanks')), new HiddenField('EmailFrom', '', $controller->getJobEmailFromAddress()), new HiddenField('EmailSubject', '', $controller->getJobEmailSubject()), $jobId = new HiddenField('JobID')));
if ($job) {
$jobId->setValue($job->ID);
$actions = new FieldList(new FormAction('doEditJob', _t('Jobboard.EDITLISTING', 'Edit Listing')));
} else {
$actions = new FieldList(new FormAction('doAddJob', _t('JobBoard.CONFIRM', 'Confirm')));
}
parent::__construct($controller, 'AddJobForm', $fields, $actions, $required);
$this->setFormAction('JobBoardFormProcessor/doJobForm');
$this->setFormMethod('POST');
if ($job) {
$this->loadDataFrom($job);
} else {
$this->enableSpamProtection();
}
}
示例2: setError
/**
* @param string $message
* @param string $messageType
*/
public function setError($message, $messageType)
{
// show the manual fields
$this->manualToggle->setValue('1');
$name = $this->getName();
$field = $this->manualFields->dataFieldByName("{$name}[{$messageType}]");
if ($field) {
$field->setError($message, 'validation');
}
}
示例3: __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'));
}
示例4: __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);
}
示例5: __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);
}
}
示例6: FieldList
function __construct($controller, $name, $speakerID, $use_actions = true)
{
$fields = new FieldList();
//point of contact
$speakerIDfield = new HiddenField('speaker_id');
$speakerIDfield->setValue($speakerID);
$fields->push($speakerIDfield);
$fields->push(new TextField('org_name', 'Name of Organizer'));
$fields->push(new EmailField('org_email', 'Email'));
$fields->push(new TextField('event_name', 'Event'));
$fields->push(new TextField('event_format', 'Format/Length'));
$fields->push(new TextField('event_attendance', 'Expected Attendance (number)'));
$fields->push(new TextField('event_date', 'Date of Event'));
$fields->push(new TextField('event_location', 'Location'));
$fields->push(new TextField('event_topic', 'Topic(s)'));
$request = new HtmlEditorField('general_request', 'General Request');
$request->setRows(10);
$fields->push($request);
$sec_field = new TextField('field_98438688', 'field_98438688');
$sec_field->addExtraClass('honey');
$fields->push($sec_field);
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('sendSpeakerEmail', 'Send'));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例7: __construct
public function __construct()
{
parent::__construct();
$language = OW::getLanguage();
$serviceLang = BOL_LanguageService::getInstance();
$addSectionForm = new Form('qst_add_section_form');
$addSectionForm->setAjax();
$addSectionForm->setAjaxResetOnSuccess(true);
$addSectionForm->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
$input = new HiddenField('command');
$input->setValue('addSection');
$addSectionForm->addElement($input);
$qstSectionName = new TextField('section_name');
$qstSectionName->addAttribute('class', 'ow_text');
$qstSectionName->addAttribute('style', 'width: auto;');
$qstSectionName->setRequired();
$qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
$addSectionForm->addElement($qstSectionName);
$this->addForm($addSectionForm);
$addSectionForm->bindJsFunction('success', ' function (result) {
if ( result.result )
{
OW.info(result.message);
}
else
{
OW.error(result.message);
}
window.location.reload();
} ');
}
示例8: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
// Add timepicker functionality
// @see https://github.com/trentrichardson/jQuery-Timepicker-Addon
Requirements::css(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css');
Requirements::css(ADVANCED_WORKFLOW_DIR . '/css/WorkflowFieldTimePicker.css');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js');
Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/javascript/WorkflowField.js');
$this->setIsWorkflowInEffect();
if ($this->getIsWorkflowInEffect()) {
$fields->addFieldsToTab('Root.PublishingSchedule', array(new HeaderField('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), new LiteralField('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = new Datetimefield('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = new Datetimefield('DesiredUnPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_UNPUBLISH_DATE', 'Requested un-publish date')), Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date'))->setDisabled(true), Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))->setDisabled(true), $uth = new HiddenField('PublishOnDateOwner')));
// Set a value to our hidden field
$uth->setValue($this->owner->PublishOnDate);
} else {
$fields->addFieldsToTab('Root.PublishingSchedule', array(new HeaderField('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), new LiteralField('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = new Datetimefield('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = new Datetimefield('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))));
}
$dt->getDateField()->setConfig('showcalendar', true);
$ut->getDateField()->setConfig('showcalendar', true);
$dt->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
$ut->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
// Enable a jQuery-UI timepicker widget
if (self::$showTimePicker) {
$dt->getTimeField()->addExtraClass('hasTimePicker');
$ut->getTimeField()->addExtraClass('hasTimePicker');
}
}
示例9: __construct
public function __construct($albumId)
{
parent::__construct(self::FORM_NAME);
$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(self::ELEMENT_ALBUM_ID);
$albumIdField->setValue($album->id);
$albumIdField->setRequired();
$albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
$this->addElement($albumIdField);
$albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
$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(self::ELEMENT_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);
$this->triggerReady(array('albumId' => $albumId));
}
示例10: __construct
public function __construct(BASE_CommentsParams $params, $id, $formName)
{
parent::__construct();
$language = OW::getLanguage();
$form = new Form($formName);
$textArea = new Textarea('commentText');
$textArea->setHasInvitation(true);
$textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text'));
$form->addElement($textArea);
$hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1);
foreach ($hiddenEls as $name => $value) {
$el = new HiddenField($name);
$el->setValue($value);
$form->addElement($el);
}
$submit = new Submit('comment-submit');
$submit->setValue($language->text('base', 'comment_add_submit_label'));
$form->addElement($submit);
$form->setAjax(true);
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
// $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}");
// $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}");
$this->addForm($form);
OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');");
$this->assign('form', true);
$this->assign('id', $id);
}
示例11: __construct
public function __construct()
{
parent::__construct('add-album');
$this->setAjax();
$this->setAjaxResetOnSuccess(FALSE);
$this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'));
$ajaxFunc = new HiddenField('ajaxFunc');
$ajaxFunc->setValue('ajaxMoveToAlbum');
$ajaxFunc->setRequired();
$this->addElement($ajaxFunc);
$fromAlbum = new HiddenField('from-album');
$fromAlbum->setRequired();
$fromAlbum->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
$this->addElement($fromAlbum);
$toAlbum = new HiddenField('to-album');
$this->addElement($toAlbum);
$photos = new HiddenField('photos');
$photos->setRequired();
$this->albumPhotosValidator = new AlbumPhotosValidator();
$photos->addValidator($this->albumPhotosValidator);
$this->addElement($photos);
$albumName = new TextField('album-name');
$albumName->setRequired();
$albumName->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE));
$albumName->setHasInvitation(TRUE);
$albumName->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
$albumName->addAttribute('class', 'ow_smallmargin');
$this->addElement($albumName);
$desc = new Textarea('desc');
$desc->setHasInvitation(TRUE);
$desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
$this->addElement($desc);
$this->addElement(new Submit('add'));
}
示例12: __construct
public function __construct($userId)
{
parent::__construct();
$data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId));
$albums = empty($data["albums"]) ? array() : $data["albums"];
$source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId);
$this->assign("source", $source == "album" ? "album" : "all");
$selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId);
$form = new Form("pcGallerySettings");
$form->setEmptyElementsErrorMessage(null);
$form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings"));
$element = new HiddenField("userId");
$element->setValue($userId);
$form->addElement($element);
$element = new Selectbox("album");
$element->setHasInvitation(true);
$element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation"));
$validator = new PCGALLERY_AlbumValidator();
$element->addValidator($validator);
$albumsPhotoCount = array();
foreach ($albums as $album) {
$element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})");
$albumsPhotoCount[$album["id"]] = $album["photoCount"];
if ($album["id"] == $selectedAlbum) {
$element->setValue($album["id"]);
}
}
OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount)));
$element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label"));
$form->addElement($element);
$submit = new Submit("save");
$submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label"));
$form->addElement($submit);
$this->addForm($form);
}
示例13: setValue
/**
*
* @param type $value
*/
public function setValue($value)
{
if (is_string($value)) {
$this->gridStateData = new GridState_Data(json_decode($value, true));
}
parent::setValue($value);
}
示例14: Field
public function Field($properties = array())
{
$titleArray = $itemIDs = array();
$titleList = $itemIDsList = "";
if ($items = $this->getItems()) {
foreach ($items as $item) {
$titleArray[] = $item->Title;
}
foreach ($items as $item) {
$itemIDs[] = $item->ID;
}
if ($titleArray) {
$titleList = implode(", ", $titleArray);
}
if ($itemIDs) {
$itemIDsList = implode(",", $itemIDs);
}
}
$field = new ReadonlyField($this->name . '_ReadonlyValue', $this->title);
$field->setValue($titleList);
$field->setForm($this->form);
$valueField = new HiddenField($this->name);
$valueField->setValue($itemIDsList);
$valueField->setForm($this->form);
return $field->Field() . $valueField->Field();
}
示例15: __construct
public function __construct($providerName)
{
parent::__construct('login-form');
$language = OW::getLanguage();
$this->setAction("");
$label = $language->text('yncontactimporter', 'login_email');
if ($providerName == 'hyves') {
$label = $language->text('yncontactimporter', 'login_username');
}
// email
$email = new TextField('email');
$email->setLabel($label)->setRequired(true);
$this->addElement($email);
//pass
$password = new PasswordField('password');
$password->setLabel($language->text('yncontactimporter', 'login_password'))->setRequired(true);
$this->addElement($password);
//providerName
$hiddenProviderName = new HiddenField('providerName');
$hiddenProviderName->setValue($providerName);
$this->addElement($hiddenProviderName);
// button submit
$submit = new Submit('submit');
$submit->setValue($language->text('yncontactimporter', 'submit_btn_label'));
$this->addElement($submit);
}