本文整理汇总了PHP中CRM_Core_Form::isSubmitted方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form::isSubmitted方法的具体用法?PHP CRM_Core_Form::isSubmitted怎么用?PHP CRM_Core_Form::isSubmitted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Form
的用法示例。
在下文中一共展示了CRM_Core_Form::isSubmitted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Add element to form.
*
* @param CRM_Core_Form $form
*/
public static function add(&$form)
{
$error = NULL;
$config = CRM_Core_Config::singleton();
$useSSL = FALSE;
if (!function_exists('recaptcha_get_html')) {
require_once 'packages/recaptcha/recaptchalib.php';
}
// See if we are using SSL
if (CRM_Utils_System::isSSL()) {
$useSSL = TRUE;
}
$html = recaptcha_get_html($config->recaptchaPublicKey, $error, $useSSL);
$form->assign('recaptchaHTML', $html);
$form->assign('recaptchaOptions', $config->recaptchaOptions);
$form->add('text', 'g-recaptcha-response', 'reCaptcha', NULL, TRUE);
$form->registerRule('recaptcha', 'callback', 'validate', 'CRM_Utils_ReCAPTCHA');
if ($form->isSubmitted() && empty($form->_submitValues['g-recaptcha-response'])) {
$form->setElementError('g-recaptcha-response', ts('Input text must match the phrase in the image. Please review the image and re-enter matching text.'));
}
}
示例2: resetElementValue
/**
* Reset values for all options those are full.
*
* @param array $optionFullIds
* @param CRM_Core_Form $form
*/
public static function resetElementValue($optionFullIds = array(), &$form)
{
if (!is_array($optionFullIds) || empty($optionFullIds) || !$form->isSubmitted()) {
return;
}
foreach ($optionFullIds as $fldId => $optIds) {
$name = "price_{$fldId}";
if (!$form->elementExists($name)) {
continue;
}
$element = $form->getElement($name);
$eleType = $element->getType();
$resetSubmitted = FALSE;
switch ($eleType) {
case 'text':
if ($element->getValue() && $element->isFrozen()) {
$label = "{$element->getLabel()}<tt>(x)</tt>";
$element->setLabel($label);
$element->setPersistantFreeze();
$resetSubmitted = TRUE;
}
break;
case 'group':
if (is_array($element->_elements)) {
foreach ($element->_elements as $child) {
$childType = $child->getType();
$methodName = 'getName';
if ($childType) {
$methodName = 'getValue';
}
if (in_array($child->{$methodName}(), $optIds) && $child->isFrozen()) {
$resetSubmitted = TRUE;
$child->setPersistantFreeze();
}
}
}
break;
case 'select':
$value = $element->getValue();
if (in_array($value[0], $optIds)) {
foreach ($element->_options as $option) {
if ($option['attr']['value'] === "crm_disabled_opt-{$value[0]}") {
$placeholder = html_entity_decode($option['text'], ENT_QUOTES, "UTF-8");
$element->updateAttributes(array('placeholder' => $placeholder));
break;
}
}
$resetSubmitted = TRUE;
}
break;
}
//finally unset values from submitted.
if ($resetSubmitted) {
self::resetSubmittedValue($name, $optIds, $form);
}
}
}