Skip to content

Commit

Permalink
[fix] error when adding tags with keyboard. Fixes #4394
Browse files Browse the repository at this point in the history
  • Loading branch information
phproberto committed Sep 30, 2014
1 parent 6612437 commit 7a1089c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libraries/cms/html/tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,9 @@ public static function tags($config = array('filter.published' => array(0, 1)))
*/
public static function ajaxfield($selector='#jform_tags', $allowCustom = true)
{

// Get the component parameters
$params = JComponentHelper::getParams("com_tags");
$minTermLength = (int) $params->get("min_term_length");
$minTermLength = (int) $params->get("min_term_length", 3);

// Tags field ajax
$chosenAjaxSettings = new JRegistry(
Expand All @@ -193,8 +192,8 @@ public static function ajaxfield($selector='#jform_tags', $allowCustom = true)
// Method to add tags pressing enter
$('" . $selector . "_chzn input').keyup(function(event) {
// Tag is greater than 3 chars and enter pressed
if (this.value.length >= " . $minTermLength . " && (event.which === 13 || event.which === 188)) {
// Tag is greater than the minimum required chars and enter pressed
if (this.value && this.value.length >= " . $minTermLength . " && (event.which === 13 || event.which === 188)) {
// Search an highlighted result
var highlighted = $('" . $selector . "_chzn').find('li.active-result.highlighted').first();
Expand Down

0 comments on commit 7a1089c

Please sign in to comment.