本文整理汇总了PHP中HTML_QuickForm::getElementError方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::getElementError方法的具体用法?PHP HTML_QuickForm::getElementError怎么用?PHP HTML_QuickForm::getElementError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::getElementError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: returnForm
/**
* Returns the HTML code of the form.
* @return string $return_value HTML code of the form
*/
public function returnForm()
{
$error = false;
/** @var HTML_QuickForm_element $element */
foreach ($this->_elements as $element) {
if (!is_null(parent::getElementError($element->getName()))) {
$error = true;
break;
}
}
$returnValue = '';
$js = null;
if ($error) {
$returnValue = Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'warning');
}
$returnValue .= $js;
$returnValue .= parent::toHtml();
// Add div-element which is to hold the progress bar
if (isset($this->with_progress_bar) && $this->with_progress_bar) {
$returnValue .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
}
return $returnValue;
}
示例2: return_form
/**
* Returns the HTML code of the form.
* If an element in the form didn't validate, an error message is showed
* asking the user to complete the form.
*
* @return string $return_value HTML code of the form
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, august 2006
*/
public function return_form()
{
$error = false;
$addDateLibraries = false;
$dateElementTypes = array('date_range_picker', 'date_time_picker', 'date_picker', 'datepicker', 'datetimepicker');
/** @var HTML_QuickForm_element $element */
foreach ($this->_elements as $element) {
if (in_array($element->getType(), $dateElementTypes)) {
$addDateLibraries = true;
}
if (!is_null(parent::getElementError($element->getName()))) {
$error = true;
break;
}
}
$return_value = '';
$js = null;
if ($addDateLibraries) {
/*
$js = api_get_js('jquery-ui/jquery-ui-i18n.min.js');
$js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'datetimepicker/jquery-ui-timepicker-addon.js" type="text/javascript"></script>';
$js .= '<link href="'.api_get_path(WEB_LIBRARY_JS_PATH).'datetimepicker/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css" />';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/moment.min.js" type="text/javascript"></script>';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/daterangepicker.js" type="text/javascript"></script>';
$js .= '<link href="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/daterangepicker-bs2.css" rel="stylesheet" type="text/css" />';
$isocode = api_get_language_isocode();
if ($isocode != 'en') {
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/datetimepicker/i18n/jquery-ui-timepicker-'.$isocode.'.js" type="text/javascript"></script>';
$js .= '<script>
$(function(){
$.datepicker.setDefaults($.datepicker.regional["'.$isocode.'"]);
moment.lang("'.$isocode.'");
});
</script>';
}*/
}
if ($error) {
$return_value = Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'warning');
}
$return_value .= $js;
$return_value .= parent::toHtml();
// Add div-element which is to hold the progress bar
if (isset($this->with_progress_bar) && $this->with_progress_bar) {
$return_value .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
}
return $return_value;
}
示例3: foreach
$params['MESSAGE'] = '<h2>Product could not be entered into the database.</h2>';
}
} else {
$params['TYPE'] = 'warning';
$params['MESSAGE'] = '<h2>This product already exits.</h2>';
}
// done!
} else {
//$this->content .= $this->getTabs(array('details', 'description', 'price', 'attributes', 'image'));
$session = Utility::encodeString(session_id());
$this->addScriptDeclaration("UthandoAdmin.sid = ['" . $session[0] . "','" . $session[1] . "'];");
$this->loadJavaScript(array('/editors/tiny_mce/tiny_mce_gzip.js', '/uthando-js/uthando/admin/tinyMCEGz.js'));
$this->addComponentJS('products');
$this->addComponentCSS(array('FileManager', 'Additions'));
foreach ($errors as $value) {
$err = $form->getElementError($value);
if ($err) {
$this->registry->Warning($err);
}
}
$renderer = new UthandoForm(TEMPLATES . $template);
$renderer->setFormTemplate('form');
$renderer->setHeaderTemplate('header');
$renderer->setElementTemplate('element');
$form->accept($renderer);
// output the form
$this->content .= $renderer->toHtml();
}
} else {
$params['TYPE'] = 'info';
if (!$tax_codes) {
示例4: returnForm
/**
* Returns the HTML code of the form.
* @return string $return_value HTML code of the form
*/
public function returnForm()
{
$returnValue = '';
/** @var HTML_QuickForm_element $element */
foreach ($this->_elements as $element) {
$elementError = parent::getElementError($element->getName());
if (!is_null($elementError)) {
$returnValue .= Display::return_message($elementError, 'warning') . '<br />';
break;
}
}
$returnValue .= parent::toHtml();
// Add div-element which is to hold the progress bar
if (isset($this->with_progress_bar) && $this->with_progress_bar) {
$returnValue .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
}
return $returnValue;
}