本文整理汇总了PHP中HiddenField::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP HiddenField::setRequired方法的具体用法?PHP HiddenField::setRequired怎么用?PHP HiddenField::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HiddenField
的用法示例。
在下文中一共展示了HiddenField::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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'));
}
示例2: __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);
}
示例3: __construct
/**
* Class constructor
*/
public function __construct()
{
parent::__construct('update-question-form');
$this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion'));
$lang = OW::getLanguage();
$questionId = new HiddenField('questionId');
$questionId->setRequired(true);
$this->addElement($questionId);
$question = new TextField('question');
$question->setRequired(true);
$question->setLabel($lang->text('ocsfaq', 'question'));
$this->addElement($question);
$btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
$answer = new WysiwygTextarea('answer', $btnSet);
$answer->setRequired(true);
$answer->setLabel($lang->text('ocsfaq', 'answer'));
$this->addElement($answer);
$isFeatured = new CheckboxField('isFeatured');
$isFeatured->setLabel($lang->text('ocsfaq', 'is_featured'));
$this->addElement($isFeatured);
$categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories();
if ($categories) {
$category = new Selectbox('category');
foreach ($categories as $cat) {
$category->addOption($cat->id, $cat->name);
}
$category->setLabel($lang->text('ocsfaq', 'category'));
$this->addElement($category);
}
// submit
$submit = new Submit('update');
$submit->setValue($lang->text('ocsfaq', 'btn_save'));
$this->addElement($submit);
}
示例4: __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));
}
示例5: __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);
}
示例6: __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);
}
示例7: __construct
public function __construct()
{
parent::__construct('goal-edit-form');
$this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
$lang = OW::getLanguage();
$id = new HiddenField('projectId');
$id->setRequired(true);
$this->addElement($id);
$name = new TextField('name');
$name->setRequired(true);
$name->setLabel($lang->text('ocsfundraising', 'name'));
$this->addElement($name);
$btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
$desc = new WysiwygTextarea('description', $btnSet);
$desc->setRequired(true);
$sValidator = new StringValidator(1, 50000);
$desc->addValidator($sValidator);
$desc->setLabel($lang->text('ocsfundraising', 'description'));
$this->addElement($desc);
$category = new Selectbox('category');
$category->setLabel($lang->text('ocsfundraising', 'category'));
$list = OCSFUNDRAISING_BOL_Service::getInstance()->getCategoryList();
if ($list) {
foreach ($list as $cat) {
$category->addOption($cat->id, $lang->text('ocsfundraising', 'category_' . $cat->id));
}
}
$this->addElement($category);
$target = new TextField('target');
$target->setRequired(true);
$target->setLabel($lang->text('ocsfundraising', 'target_amount'));
$this->addElement($target);
$min = new TextField('min');
$min->setLabel($lang->text('ocsfundraising', 'min_amount'));
$min->setValue(1);
$this->addElement($min);
$end = new DateField('end');
$end->setMinYear(date('Y'));
$end->setMaxYear(date('Y') + 2);
$end->setLabel($lang->text('ocsfundraising', 'end_date'));
$this->addElement($end);
$imageField = new FileField('image');
$imageField->setLabel($lang->text('ocsfundraising', 'image_label'));
$this->addElement($imageField);
$submit = new Submit('edit');
$submit->setLabel($lang->text('ocsfundraising', 'edit'));
$this->addElement($submit);
}
示例8: __construct
/**
* Class constructor
*/
public function __construct()
{
parent::__construct('update-category-form');
$this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editCategory'));
$lang = OW::getLanguage();
$catId = new HiddenField('cId');
$catId->setRequired(true);
$this->addElement($catId);
$name = new TextField('name');
$name->setRequired(true);
$name->setLabel($lang->text('ocsfaq', 'category'));
$this->addElement($name);
// submit
$submit = new Submit('update');
$submit->setValue($lang->text('ocsfaq', 'btn_save'));
$this->addElement($submit);
}
示例9: __construct
public function __construct($photoId = NULL)
{
parent::__construct('photo-edit-form');
$this->setAjax(TRUE);
$this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
$this->bindJsFunction('success', 'function( data )
{
OW.trigger("photo.afterPhotoEdit", data);
}');
$photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
$album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
$photoIdField = new HiddenField('photoId');
$photoIdField->setRequired(TRUE);
$photoIdField->setValue($photo->id);
$photoIdField->addValidator(new PHOTO_CLASS_PhotoOwnerValidator());
$this->addElement($photoIdField);
$albumField = new TextField('album');
$albumField->setId('ajax-upload-album');
$albumField->setRequired();
$albumField->setValue($album->name);
$albumField->setLabel(OW::getLanguage()->text('photo', 'create_album'));
$albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
$albumField->addAttribute('autocomplete', 'off');
$albumField->addAttribute('readonly');
$this->addElement($albumField);
$albumNameField = new TextField('album-name');
$albumNameField->setRequired();
$albumNameField->setValue($album->name);
$albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE, NULL, $album->name));
$albumNameField->setHasInvitation(TRUE);
$albumNameField->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
$albumNameField->addAttribute('class', 'ow_smallmargin invitation');
$this->addElement($albumNameField);
$desc = new Textarea('description');
$desc->setHasInvitation(TRUE);
$desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
$this->addElement($desc);
$photoDesc = new PHOTO_CLASS_HashtagFormElement('photo-desc');
$photoDesc->setValue($photo->description);
$photoDesc->setLabel(OW::getLanguage()->text('photo', 'album_desc'));
$this->addElement($photoDesc);
$submit = new Submit('edit');
$submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
$this->addElement($submit);
}
示例10: __construct
public function __construct()
{
parent::__construct('album-cover-maker');
$this->setAjax(TRUE);
$this->setAction(OW::getRouter()->urlForRoute('photo.ajax_album_cover'));
$this->setAjaxResetOnSuccess(TRUE);
$coords = new HiddenField('coords');
$this->addElement($coords);
$albumIdField = new HiddenField('albumId');
$albumIdField->setRequired();
$albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
$this->addElement($albumIdField);
$photoIdField = new HiddenField('photoId');
$this->addElement($photoIdField);
$submit = new Submit('save');
$submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
$this->addElement($submit);
}
示例11: __construct
/**
* Class constructor
*/
public function __construct($photoId)
{
parent::__construct('photo-edit-form');
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
$language = OW::getLanguage();
$photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
$album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
$userId = OW::getUser()->getId();
// photo id field
$photoIdField = new HiddenField('id');
$photoIdField->setRequired(true);
$this->addElement($photoIdField);
// photo album Field
$albumField = new SuggestField('album');
$responderUrl = OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'suggestAlbum', array('userId' => $userId));
$albumField->setResponderUrl($responderUrl);
if ($album) {
$albumField->setValue($album->name);
}
$albumField->setRequired(true);
$albumField->setLabel($language->text('photo', 'album'));
$this->addElement($albumField);
// description Field
$descField = new WysiwygTextarea('description', null, false);
$descField->setId("photo-desc-area");
$this->addElement($descField->setLabel($language->text('photo', 'description')));
$tags = array();
$entityTags = BOL_TagService::getInstance()->findEntityTags($photo->id, 'photo');
if ($entityTags) {
$tags = array();
foreach ($entityTags as $entityTag) {
$tags[] = $entityTag->label;
}
$tagsField = new TagsInputField('tags');
$tagsField->setValue($tags);
} else {
$tagsField = new TagsInputField('tags');
}
$this->addElement($tagsField->setLabel($language->text('photo', 'tags')));
$submit = new Submit('edit');
$submit->setValue($language->text('photo', 'btn_edit'));
$this->addElement($submit);
}
示例12: __construct
public function __construct($name, $affiliateId = null)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_register_payout'));
$this->setAjax(true);
$lang = OW::getLanguage();
$amount = new TextField('amount');
$amount->setLabel($lang->text('ocsaffiliates', 'amount_paid'));
$amount->setRequired(true);
$this->addElement($amount);
$affiliate = new HiddenField('affiliateId');
$affiliate->setRequired(true);
$this->addElement($affiliate);
$byCredits = new CheckboxField('byCredits');
$byCredits->setLabel($lang->text('ocsaffiliates', 'deposit_credits'));
$this->addElement($byCredits);
$submit = new Submit('add');
$submit->setValue($lang->text('ocsaffiliates', 'register_btn'));
$this->addElement($submit);
$this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n if ( !data.result ) {\n OW.error(data.error);\n }\n else {\n document.location.reload();\n }\n }");
}
示例13: __construct
public function __construct($name, $affiliateId = null)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_assign_user'));
$this->setAjax();
$this->setAjaxResetOnSuccess(false);
$lang = OW::getLanguage();
$user = new TextField('user');
$user->setLabel($lang->text('ocsaffiliates', 'assign_to_username'));
$user->setInvitation($lang->text('ocsaffiliates', 'username'));
$user->setHasInvitation(true);
$user->setRequired(true);
$this->addElement($user);
$affiliate = new HiddenField('affiliateId');
$affiliate->setRequired(true);
$this->addElement($affiliate);
$submit = new Submit('assign');
$submit->setValue($lang->text('ocsaffiliates', 'assign_btn'));
$this->addElement($submit);
$this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n if ( data.result == 'false' ) {\n OW.error(data.error);\n }\n else {\n document.location.reload();\n }\n }");
}
示例14: __construct
public function __construct()
{
parent::__construct('set-membership-form');
$this->setAjaxResetOnSuccess(false);
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlForRoute('membership_set'));
$lang = OW::getLanguage();
$userId = new HiddenField('userId');
$userId->setRequired(true);
$this->addElement($userId);
$types = new RadioGroupItemField('type');
$types->setRequired(true);
$types->setLabel($lang->text('membership', 'set_membership'));
$this->addElement($types);
$period = new TextField('period');
$period->setLabel($lang->text('membership', 'set_period'));
$this->addElement($period);
$submit = new Submit('set');
$submit->setValue($lang->text('membership', 'set'));
$this->addElement($submit);
}
示例15: __construct
/**
* Class constructor
*/
public function __construct($tpls)
{
parent::__construct('edit-template-form');
$this->setAction(OW::getRouter()->urlFor('VIRTUALGIFTS_CTRL_Admin', 'editTemplate'));
$single = count($tpls) == 1;
$this->setEnctype('multipart/form-data');
$language = OW::getLanguage();
$giftService = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance();
if ($single) {
$file = new FileField('file');
$file->setLabel($language->text('virtualgifts', 'gift_image'));
$this->addElement($file);
$tpl = $giftService->findTemplateById($tpls[0]);
}
$tplId = new HiddenField('tplId');
$tplId->setRequired(true);
$tplId->setValue(implode('|', $tpls));
$this->addElement($tplId);
if ($giftService->categoriesSetup()) {
$categories = new Selectbox('category');
$categories->setLabel($language->text('virtualgifts', 'category'));
$categories->setOptions($giftService->getCategories());
if ($single && isset($tpl)) {
$categories->setValue($tpl->categoryId);
}
$this->addElement($categories);
}
if (OW::getPluginManager()->isPluginActive('usercredits')) {
$price = new TextField('price');
$price->setLabel($language->text('virtualgifts', 'gift_price'));
if ($single && isset($tpl)) {
$price->setValue($tpl->price);
}
$this->addElement($price);
}
// submit
$submit = new Submit('save');
$submit->setValue($language->text('virtualgifts', 'btn_save'));
$this->addElement($submit);
}