本文整理汇总了PHP中HiddenField类的典型用法代码示例。如果您正苦于以下问题:PHP HiddenField类的具体用法?PHP HiddenField怎么用?PHP HiddenField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HiddenField类的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: __construct
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);
}
示例3: __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();
} ');
}
示例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);
}
}
示例5: __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'));
}
示例6: __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));
}
示例7: __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);
}
示例8: __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'));
}
示例9: 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();
}
示例10: 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');
}
}
示例11: __construct
/**
* Initiate the standard Metadata catalogue search form. The
* additional parameter $defaults defines the default values for the form.
*
* @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 FieldSet $fields All of the fields in the form - a {@link FieldSet} of {@link FormField} objects.
* @param FieldSet $actions All of the action buttons in the form - a {@link FieldSet} of {@link FormAction} objects
* @param Validator $validator Override the default validator instance (Default: {@link RequiredFields})
* @param Array $defaults Override the default values of the form.
*/
function __construct($controller, $name, FieldSet $fields = null, FieldSet $actions = null, $validator = null, $defaults = null)
{
$format = $defaults['format'];
$searchTerm = $defaults['searchTerm'];
$bboxUpper = $bboxLower = null;
if (isset($defaults['bboxUpper']) && isset($defaults['bboxLower'])) {
$bboxUpper = $defaults['bboxUpper'];
$bboxLower = $defaults['bboxLower'];
}
$values = CataloguePage_Controller::get_standard_names();
$upperField = new HiddenField('bboxUpper', _t('SearchForm.SEARCH', 'bboxUpper'), $bboxUpper);
$upperField->addExtraClass('upper');
$lowerField = new HiddenField('bboxLower', _t('SearchForm.SEARCH', 'bboxLower'), $bboxLower);
$lowerField->addExtraClass('lower');
if (!$fields) {
$fields = new FieldSet(new TextField('searchTerm', _t('SearchForm.SEARCH', 'Search'), $searchTerm), $upperField, $lowerField, new OptionsetField('format', _t('SearchForm.MetadataStandard', 'Metadata Standard'), $values, $format));
}
if (singleton('SiteTree')->hasExtension('Translatable')) {
$fields->push(new HiddenField('locale', 'locale', Translatable::get_current_locale()));
}
if (!$actions) {
$actions = new FieldSet(new FormAction("submit", _t('SearchForm.Search', 'Search')));
}
parent::__construct($controller, $name, $fields, $actions);
$this->setFormMethod('get');
}
示例12: __construct
public function __construct()
{
parent::__construct('set-credits-form');
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlFor('USERCREDITS_CTRL_Ajax', 'setCredits'));
$lang = OW::getLanguage();
$userIdField = new HiddenField('userId');
$userIdField->setRequired(true);
$this->addElement($userIdField);
$balance = new TextField('balance');
$this->addElement($balance);
$submit = new Submit('save');
$submit->setValue($lang->text('base', 'edit_button'));
$this->addElement($submit);
$js = 'owForms["' . $this->getName() . '"].bind("success", function(data){
if ( data.error ){
OW.error(data.error);
}
if ( data.message ) {
OW.info(data.message);
}
_scope.floatBox && _scope.floatBox.close();
_scope.callBack && _scope.callBack(data);
});';
OW::getDocument()->addOnloadScript($js);
}
示例13: __construct
public function __construct()
{
parent::__construct('delete-membership-form');
$this->setAjaxResetOnSuccess(false);
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlForRoute('membership_delete_type'));
$lang = OW::getLanguage();
$typeId = new HiddenField('typeId');
$typeId->setRequired(true);
$this->addElement($typeId);
$newTypeId = new Selectbox('newTypeId');
$newTypeId->setHasInvitation(false);
$this->addElement($newTypeId);
$types = new RadioGroupItemField('type');
$types->setRequired(true);
$types->setLabel($lang->text('membership', 'set_membership'));
$this->addElement($types);
$this->bindJsFunction(Form::BIND_SUCCESS, "function( data ) {\n if ( data.result ) {\n document.location.reload();\n }\n }");
$script = '$("#btn-confirm-type-delete").click(function(){
if ( confirm(' . json_encode($lang->text('membership', 'type_delete_confirm')) . ') ) {
$(this).parents("form:eq(0)").submit();
}
});
';
OW::getDocument()->addOnloadScript($script);
}
示例14: render
public function render()
{
$name = $this->getName();
$hidden = new HiddenField($name, $this->getValue());
$id = $this->getId();
$hidden->addAttribute("id", $id);
$ret = $hidden->render();
if ($this->storedFieldSet === false) {
$this->addSearchField($this->storedField);
$this->storedFieldSet = true;
}
$object = array("model" => $this->model->package, "format" => "json", "fields" => $this->searchFields, "limit" => 20, "conditions" => "", "and_conditions" => $this->andConditions);
$jsonSearchFields = array_reverse($this->searchFields);
$object = base64_encode(serialize($object));
$path = Application::$prefix . "/lib/models/urlaccess.php?object={$object}";
$fields = urlencode(json_encode($jsonSearchFields));
$text = new TextField();
$text->addAttribute("onkeyup", "fapiUpdateSearchField('{$id}','{$path}','{$fields}',this," . ($this->boldFirst ? "true" : "false") . ",'{$this->onChangeAttribute}')");
$text->addAttribute("autocomplete", "off");
if ($this->getValue() != "") {
$data = $this->model[$this->getValue()];
for ($i = 2; $i < count($jsonSearchFields); $i++) {
$val .= $data[0][$jsonSearchFields[$i]] . " ";
}
$text->setValue($val);
}
$text->setId($id . "_search_entry");
$ret .= $text->render();
$ret .= "<div class='fapi-popup' id='{$id}_search_area'></div>";
return $ret;
}
示例15: updateLinkForm
public function updateLinkForm($form)
{
Requirements::javascript("linkableobjects/javascript/CustomHtmlEditorField.js");
$count = 0;
foreach ($form->Fields() as $field) {
$count++;
if ($count == 2) {
$linkType = $field->fieldByName('LinkType');
$types = $linkType->getSource();
$link = new HtmlEditorField_LinkObjects();
$linkableObjects = $link->getLinkableObjects();
foreach ($linkableObjects as $object => $title) {
$types[$object] = $title;
$picker = new DataObjectPicker($object . 'LinkID', $title);
$picker->setConfig('limit', 5);
$picker->setConfig('classToPick', $object);
$picker->setForm($form);
$field->insertBefore($picker, 'Description');
}
$linkMap = new HiddenField('LinkableObjects');
$linkMap->setAttribute('data-map', json_encode($linkableObjects));
$field->push($linkMap);
$linkType->setSource($types);
}
}
}