本文整理汇总了PHP中TextField::addValidator方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::addValidator方法的具体用法?PHP TextField::addValidator怎么用?PHP TextField::addValidator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::addValidator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: __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);
}
示例3: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$configs = OW::getConfig()->getValues('googlelocation');
$element = new TextField('api_key');
$element->setValue($configs['api_key']);
$validator = new StringValidator(0, 40);
$validator->setErrorMessage($language->text('googlelocation', 'api_key_too_long'));
$element->addValidator($validator);
$this->addElement($element);
$options = array(GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_MILES => $language->text('googlelocation', 'miles'), GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_KM => $language->text('googlelocation', 'kms'));
$distanseUnits = new Selectbox('distanse_units');
$distanseUnits->setOptions($options);
$distanseUnits->setValue(GOOGLELOCATION_BOL_LocationService::getInstance()->getDistanseUnits());
$distanseUnits->setHasInvitation(false);
$this->addElement($distanseUnits);
$restrictions = new Selectbox('country_restriction');
$restrictions->setValue(!empty($configs['country_restriction']) ? $configs['country_restriction'] : null);
$restrictions->setOptions($this->countryList);
$restrictions->setInvitation(OW::getLanguage()->text('googlelocation', 'no_country_restriction'));
$this->addElement($restrictions);
$autofill = OW::getConfig()->getValue('googlelocation', 'auto_fill_location_on_search');
$autoFillLocationOnSearch = new CheckboxField('auto_fill_location_on_search');
$autoFillLocationOnSearch->setValue(empty($autofill) || $autofill == '0' ? false : $autofill);
$this->addElement($autoFillLocationOnSearch);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('base', 'edit_button'));
$this->addElement($submit);
}
示例4: __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);
}
示例5: __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'));
}
示例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($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 }");
}
示例8: 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);
}
示例9: 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');
}
示例10: __construct
public function __construct($interlocutorId)
{
$language = OW::getLanguage();
parent::__construct('mailbox-create-conversation-form');
$this->setAction(OW::getRouter()->urlFor('MAILBOX_CTRL_Mailbox', 'sendMessageAjaxResponder', array('userId' => $interlocutorId)));
$this->setId('mailbox-create-conversation-form');
$this->setEnctype('multipart/form-data');
$this->setAjax();
$this->setAjaxResetOnSuccess(false);
$hidden = new HiddenField('userId');
$hidden->setValue($interlocutorId);
$this->addElement($hidden);
//thickbox
$validatorSubject = new StringValidator(0, 2048);
$validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
$subject = new TextField('subject');
$subject->setLabel($language->text('mailbox', 'subject'))->addAttribute('class', 'ow_text');
$subject->addValidator($validatorSubject);
$subject->setRequired(true);
$this->addElement($subject);
$validatorTextarea = new StringValidator(0, 24000);
$validatorTextarea->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000)));
$message = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), false);
$message->setLabel($language->text('mailbox', 'text'))->addAttribute('class', 'ow_text');
$message->addAttribute('rows', '10');
$message->addValidator($validatorTextarea);
$message->setRequired(true);
$this->addElement($message);
if (OW::getConfig()->getValue('mailbox', 'enable_attachments')) {
$multiUpload = new MAILBOX_CLASS_AjaxFileUpload('attachments');
$multiUpload->setId('attachments');
$this->addElement($multiUpload);
}
$captcha = new MailboxCaptchaField('captcha');
$captcha->addValidator(new MailboxCaptchaValidator($captcha->getId()));
$LastSendStamp = BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_create_conversation_stamp', OW::getUser()->getId());
$this->displayCapcha = BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_create_conversation_display_capcha', OW::getUser()->getId());
if (!$this->displayCapcha && $LastSendStamp + self::DISPLAY_CAPTCHA_TIMEOUT > time()) {
BOL_PreferenceService::getInstance()->savePreferenceValue('mailbox_create_conversation_display_capcha', true, OW::getUser()->getId());
$this->displayCapcha = true;
}
$captcha->addAttribute('disabled', 'disabled');
$this->addElement($captcha);
$submit = new Submit('send');
$submit->setValue($language->text('mailbox', 'send_button'));
$submit->addAttribute('class', 'ow_button ow_ic_mail');
$this->addElement($submit);
if (!OW::getRequest()->isAjax()) {
$messageError = $language->text('mailbox', 'create_conversation_fail_message');
$messageSuccess = $language->text('mailbox', 'create_conversation_message');
$js = " owForms['mailbox-create-conversation-form'].bind( 'success',\n function( json )\n {\n var from = \$('#mailbox-create-conversation-form');\n var captcha = from.find('input[name=captcha]');\n\n if ( json.result == 'permission_denied' )\n {\n if ( json.message != undefined )\n {\n OW.error(json.message);\n }\n else\n {\n OW.error(" . json_encode(OW::getLanguage()->text('mailbox', 'write_permission_denied')) . ");\n }\n }\n else if ( json.result == 'display_captcha' )\n \t{\n window." . $captcha->jsObjectName . ".refresh();\n\n if ( captcha.attr('disabled') != 'disabled' )\n {\n owForms['mailbox-create-conversation-form'].getElement('captcha').showError(" . json_encode(OW::getLanguage()->text('base', 'form_validator_captcha_error_message')) . ");\n }\n else\n {\n captcha.removeAttr('disabled');\n }\n\n from.find('tr.captcha').show();\n from.find('tr.mailbox_conversation').hide();\n }\n else if ( json.result == true )\n \t{\n \t window.mailbox_send_message_floatbox.close();\n \$('#attach_file_inputs').hide();\n\n captcha.attr('disabled','disabled');\n from.find('tr.captcha').hide();\n owForms['mailbox-create-conversation-form'].resetForm();\n window." . $captcha->jsObjectName . ".refresh();\n\n \t OW.info('{$messageSuccess}');\n from.find('tr.captcha').hide();\n from.find('tr.mailbox_conversation').show();\n }\n else\n {\n OW.error('{$messageError}');\n }\n\n \$('#mailbox-create-conversation-form input[name=userId]').val(" . $interlocutorId . ");\n\n \t} ); ";
OW::getDocument()->addOnloadScript($js);
}
}
示例11: __construct
public function __construct($name)
{
parent::__construct($name);
$lang = OW::getLanguage();
$period = new TextField('period');
$period->setRequired(true);
$period->setLabel($lang->text('ocsaffiliates', 'settings_timeout'));
$this->addElement($period);
$status = new Selectbox('status');
$status->setRequired(true);
$status->setHasInvitation(false);
$options = array('active' => $lang->text('ocsaffiliates', 'status_active'), 'unverified' => $lang->text('ocsaffiliates', 'status_unverified'));
$status->addOptions($options);
$status->setLabel($lang->text('ocsaffiliates', 'settings_status'));
$this->addElement($status);
$clickAmount = new TextField('clickAmount');
$clickAmount->setRequired(true);
$clickAmount->setLabel($lang->text('ocsaffiliates', 'settings_click_amount'));
$clickAmount->addValidator(new FloatValidator());
$this->addElement($clickAmount);
$regAmount = new TextField('regAmount');
$regAmount->setRequired(true);
$regAmount->setLabel($lang->text('ocsaffiliates', 'settings_reg_amount'));
$regAmount->addValidator(new FloatValidator());
$this->addElement($regAmount);
$saleCommission = new Selectbox('saleCommission');
$saleCommission->setRequired(true);
$options = array('amount' => $lang->text('ocsaffiliates', 'commission_amount'), 'percent' => $lang->text('ocsaffiliates', 'commission_percent'));
$saleCommission->addOptions($options);
$saleCommission->setLabel($lang->text('ocsaffiliates', 'settings_sale_commission'));
$this->addElement($saleCommission);
$saleAmount = new TextField('saleAmount');
$saleAmount->setLabel($lang->text('ocsaffiliates', 'settings_sale_amount'));
$saleAmount->addValidator(new FloatValidator());
$this->addElement($saleAmount);
$salePercent = new TextField('salePercent');
$salePercent->setLabel($lang->text('ocsaffiliates', 'settings_sale_percent'));
$salePercent->addValidator(new FloatValidator());
$this->addElement($salePercent);
$showRates = new CheckboxField('showRates');
$showRates->setLabel($lang->text('ocsaffiliates', 'show_rates'));
$this->addElement($showRates);
$allowBanners = new CheckboxField('allowBanners');
$allowBanners->setLabel($lang->text('ocsaffiliates', 'allow_banners'));
$this->addElement($allowBanners);
$terms = new CheckboxField('terms');
$terms->setLabel($lang->text('ocsaffiliates', 'enable_terms'));
$this->addElement($terms);
$submit = new Submit('save');
$submit->setLabel($lang->text('ocsaffiliates', 'save'));
$this->addElement($submit);
}
示例12: __construct
public function __construct($name, $senderId, $context = MCOMPOSE_BOL_Service::CONTEXT_USER, $initJs = true, $inPopup = true)
{
parent::__construct($name);
$language = OW::getLanguage();
$this->userId = $senderId;
$this->context = $context;
$this->setAction(OW::getRouter()->urlFor('MCOMPOSE_CTRL_Compose', 'send', array('userId' => $senderId, 'formName' => $this->getName())));
$this->setMethod(self::METHOD_POST);
$this->setId($this->getName());
$this->setEnctype('multipart/form-data');
$this->setAjax();
$this->setAjaxResetOnSuccess(false);
$to = new MCOMPOSE_CLASS_UserSelectField('recipients', OW::getLanguage()->text('mcompose', 'selector_invitation_label'));
$to->setRequired();
$this->addElement($to);
//thickbox
$validatorSubject = new StringValidator(0, 2048);
$validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
$subject = new TextField('subject');
$subject->setInvitation('Subject');
$subject->setHasInvitation(true);
$subject->setLabel($language->text('mailbox', 'subject'))->addAttribute('class', 'ow_text');
$subject->addValidator($validatorSubject);
$subject->setRequired(true);
$this->addElement($subject);
$validatorTextarea = new StringValidator(0, 24000);
$validatorTextarea->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000)));
$message = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), true);
$message->setLabel($language->text('mailbox', 'text'))->addAttribute('class', 'ow_text');
$message->setSize(300);
$message->addValidator($validatorTextarea);
$message->setRequired(true);
$this->addElement($message);
if (OW::getConfig()->getValue('mailbox', 'enable_attachments')) {
$multiUpload = new MAILBOX_CLASS_AjaxFileUpload('attachments');
//$multiUpload->setId('attachments');
$this->addElement($multiUpload);
}
// Captcha
$captcha = new MailboxCaptchaField('captcha');
$captcha->addValidator(new MailboxCaptchaValidator($captcha->getId()));
$captcha->addAttribute('disabled', 'disabled');
$this->addElement($captcha);
$submit = new Submit('send');
$submit->setValue($language->text('mailbox', 'send_button'));
$submit->addAttribute('class', 'ow_button ow_ic_mail');
$this->addElement($submit);
if ($initJs) {
$js = "owForms['" . $this->getName() . "'].bind( 'success',\n function( json )\n {\n var _complete = function(){ \n if ( _scope.floatBox ) _scope.floatBox.close();\n };\n\n var form = \$('#" . $this->getName() . "');\n var captcha = form.find('input[name=captcha]');\n\n if ( json.result == 'permission_denied' )\n {\n if ( json.message )\n {\n OW.error(json.message);\n }\n else\n {\n OW.error(" . json_encode(OW::getLanguage()->text('mailbox', 'write_permission_denied')) . ");\n }\n \n _complete();\n }\n else if ( json.result == 'display_captcha' )\n \t{\n window." . $captcha->jsObjectName . ".refresh();\n\n if ( captcha.attr('disabled') != 'disabled' )\n {\n owForms['" . $this->getName() . "'].getElement('captcha').showError(" . json_encode(OW::getLanguage()->text('base', 'form_validator_captcha_error_message')) . ");\n }\n else\n {\n captcha.removeAttr('disabled');\n }\n\n form.find('tr.captcha').show();\n form.find('tr.mailbox_conversation').hide();\n }\n else if ( json.result == true )\n \t{\n captcha.attr('disabled','disabled');\n form.find('tr.captcha').hide();\n window." . $captcha->jsObjectName . ".refresh();\n\n form.find('tr.captcha').hide();\n form.find('tr.mailbox_conversation').show();\n\n owForms['" . $this->getName() . "'].resetForm();\n form.find('textarea[name=message]').get(0).htmlareaRefresh();\n\n if ( json.error )\n OW.error(json.error);\n\n if ( json.warning )\n OW.warning(json.warning);\n\n if ( json.message )\n OW.info(json.message);\n \n _complete();\n }\n else if ( json.error )\n {\n OW.error(json.error);\n \n _complete();\n }\n\n }); ";
OW::getDocument()->addOnloadScript($js);
}
}
示例13: __construct
public function __construct()
{
parent::__construct('config-form');
$lang = OW::getLanguage();
$months = new TextField('months');
$months->setRequired(true);
$months->addValidator(new IntValidator(1, 12));
$months->setLabel($lang->text('ocsguests', 'store_period'));
$this->addElement($months);
$submit = new Submit('save');
$submit->setLabel($lang->text('ocsguests', 'save'));
$this->addElement($submit);
}
示例14: __construct
public function __construct()
{
parent::__construct('settings-form');
$lang = OW::getLanguage();
$period = new TextField('period');
$period->setLabel($lang->text('membership', 'remind_expiration'));
$period->setRequired(true);
$period->addValidator(new IntValidator(2, 10000));
$this->addElement($period);
$submit = new Submit('save');
$submit->setValue($lang->text('base', 'edit_button'));
$this->addElement($submit);
}
示例15: __construct
public function __construct()
{
parent::__construct('insertVideo');
// link
$linkField = new TextField('link');
$linkField->setRequired(true)->setHasInvitation(true)->setInvitation(OW::getLanguage()->text('base', 'ws_video_text_label'));
$linkField->addValidator(new UrlValidator());
$this->addElement($linkField);
// submit
$submit = new Submit('submit');
$submit->setValue(OW::getLanguage()->text('base', 'ws_insert_label'));
$this->addElement($submit);
}