本文整理汇总了PHP中TextField::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::setRequired方法的具体用法?PHP TextField::setRequired怎么用?PHP TextField::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例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);
}
示例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: 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);
}
示例5: 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');
}
示例6: __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'));
}
示例7: __construct
/**
* Constructor.
*/
public function __construct($ajax = false)
{
parent::__construct();
$form = new Form('sign-in');
$form->setAction("");
$username = new TextField('identity');
$username->setRequired(true);
$username->setHasInvitation(true);
$username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
$form->addElement($username);
$password = new PasswordField('password');
$password->setHasInvitation(true);
$password->setInvitation('password');
$password->setRequired(true);
$form->addElement($password);
$remeberMe = new CheckboxField('remember');
$remeberMe->setValue(true);
$remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
$form->addElement($remeberMe);
$submit = new Submit('submit');
$submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
$form->addElement($submit);
$this->addForm($form);
if ($ajax) {
$form->setAjaxResetOnSuccess(false);
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
$form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
$this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
}
$this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
}
示例8: __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);
}
示例9: __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);
}
}
示例10: __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();
} ');
}
示例11: __construct
public function __construct($name)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
$this->setAjax();
$lang = OW::getLanguage();
$affName = new TextField('name');
$affName->setRequired(true);
$affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
$this->addElement($affName);
$email = new TextField('email');
$email->setRequired(true);
$email->setLabel($lang->text('ocsaffiliates', 'email'));
$email->addValidator(new EmailValidator());
$this->addElement($email);
$password = new PasswordField('password');
$password->setRequired(true);
$password->setLabel($lang->text('ocsaffiliates', 'password'));
$this->addElement($password);
$payment = new Textarea('payment');
$payment->setRequired(true);
$payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
$this->addElement($payment);
if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
$terms = new CheckboxField('terms');
$validator = new RequiredValidator();
$validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
$terms->addValidator($validator);
$this->addElement($terms);
}
$submit = new Submit('signup');
$submit->setValue($lang->text('ocsaffiliates', 'signup_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 }");
}
示例12: __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);
}
示例13: __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));
}
示例14: __construct
public function __construct($configs, $features)
{
parent::__construct('MCOMPOSE_ConfigForm');
$this->configs = $configs;
$language = OW::getLanguage();
$field = new TextField('max_users');
$field->setRequired();
$field->setValue($configs['max_users']);
$this->addElement($field);
if ($features["friends"]) {
$field = new CheckboxField('friends_enabled');
$field->setValue($configs['friends_enabled']);
$this->addElement($field);
}
if ($features["groups"]) {
$field = new CheckboxField('groups_enabled');
$field->setValue($configs['groups_enabled']);
$this->addElement($field);
}
if ($features["events"]) {
$field = new CheckboxField('events_enabled');
$field->setValue($configs['events_enabled']);
$this->addElement($field);
}
// submit
$submit = new Submit('save');
$submit->setValue($language->text('mcompose', 'admin_save_btn'));
$this->addElement($submit);
}
示例15: index
public function index($params = array())
{
$userService = BOL_UserService::getInstance();
$language = OW::getLanguage();
$this->setPageHeading($language->text('hotlist', 'admin_heading_settings'));
$this->setPageHeadingIconClass('ow_ic_gear_wheel');
$settingsForm = new Form('settingsForm');
$settingsForm->setId('settingsForm');
$expiration_time = new TextField('expiration_time');
$expiration_time->setRequired();
$expiration_time->setLabel($language->text('hotlist', 'label_expiration_time'));
$expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400;
$expiration_time->setValue($expiration_time_value);
$settingsForm->addElement($expiration_time);
$submit = new Submit('save');
$submit->addAttribute('class', 'ow_ic_save');
$submit->setValue($language->text('hotlist', 'label_save_btn_label'));
$settingsForm->addElement($submit);
$this->addForm($settingsForm);
if (OW::getRequest()->isPost()) {
if ($settingsForm->isValid($_POST)) {
$data = $settingsForm->getValues();
OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400);
OW::getFeedback()->info($language->text('hotlist', 'settings_saved'));
$this->redirect();
}
}
}