在civicrm中自动完成搜索结果问题

时间:2014-07-28 08:37:08

标签: jquery civicrm

如果搜索字段包含撇号,则在civicrm中自动完成搜索不会显示任何结果。任何评论都将受到高度赞赏。

2 个答案:

答案 0 :(得分:1)

这是civicrm中的问题“drupal_site \ sites \ all \ modules \ civicrm \ CRM \ Contact \ Page \ AJAX.php”

 static function autocomplete() {
    $fieldID       = CRM_Utils_Type::escape($_GET['cfid'], 'Integer');
    $optionGroupID = CRM_Utils_Type::escape($_GET['ogid'], 'Integer');
    $label         = CRM_Utils_Type::escape($_GET['s'], 'String');

    $selectOption = CRM_Core_BAO_CustomOption::valuesByID($fieldID, $optionGroupID);

    $completeList = NULL;
    foreach ($selectOption as $id => $value) {
      if (strtolower($label) == strtolower(substr($value, 0, strlen($label)))) {
        echo $completeList = "$value|$id\n";
      }
    }
    CRM_Utils_System::civiExit();
  }

需要删除转义功能。

$label         = $_GET['s'];

解决了我的问题。

答案 1 :(得分:0)

你应该在使用php中的addslashes();函数将它添加到数组之前转义字符串,如下所示:

PHP:

$str="this a string with ' ";
$str=addslashes($str);

JS:

var string_from_php=<?php echo $str; ?>

这应该只适用于fin。如果你从你的代码中添加一个snipet来填充gos到自动完成的数组我会更多的帮助

相关问题