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


PHP HiddenField::addValidator方法代码示例

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


在下文中一共展示了HiddenField::addValidator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:34,代码来源:album_add_form.php

示例2: __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);
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:27,代码来源:album_edit_form.php

示例3: __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));
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:28,代码来源:album_edit_form.php

示例4: __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);
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:45,代码来源:edit_form.php

示例5: __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);
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:18,代码来源:make_album_cover.php

示例6: __construct

 public function __construct($recipientId)
 {
     parent::__construct('send-gift-form');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('VIRTUALGIFTS_CTRL_Gifts', 'ajaxSendGift'));
     $lang = OW::getLanguage();
     $tplId = new HiddenField('tplId');
     $v = new RequiredValidator();
     $v->setErrorMessage($lang->text('virtualgifts', 'gift_not_selected'));
     $tplId->addValidator($v);
     $this->addElement($tplId);
     $message = new Textarea('message');
     $this->addElement($message);
     $recipient = new HiddenField('recipientId');
     $recipient->setValue($recipientId);
     $this->addElement($recipient);
     $user = BOL_UserService::getInstance()->getUserName($recipientId);
     $isPrivate = new CheckboxField('isPrivate');
     $isPrivate->setLabel($lang->text('virtualgifts', 'send_private_gift', array('user' => $user)));
     $this->addElement($isPrivate);
     $submit = new Submit('send');
     $submit->setValue($lang->text('virtualgifts', 'btn_send'));
     $this->addElement($submit);
     $js = 'owForms["' . $this->getName() . '"].bind("success", function(data){
         if ( data.error != undefined ){
             OW.error(data.error);
         }
         if ( data.message != undefined ){
             OW.info(data.message);
         }
         sendGiftFloatBox.close()
     });';
     OW::getDocument()->addOnloadScript($js);
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:34,代码来源:send_gift.php


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