yairEO/tagify

Help with "tagData"

オープン

#1,018 opened on 2022/04/22

 (10 件のコメント) (0 件のリアクション) (0 人の担当者)HTML (456 件のフォーク)github user discovery
Help wanted

Repository metrics

Stars
 (3,880 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Hello guys!

I'm giving Tagify a little strange use. In a form, to add new students, there is a field where some observations can be entered by the operator.

With the code below, I make the observations to be entered with the current date and the operator name.

cObs.getDispElem().tagify ({
  duplicates : true,
  maxTags : Infinity,
  delimiters : "\n|\r",
  transformTag : transformTag, 
  placeholder : "Observation...",
  editTags : true,
  pasteAsTags : true,
  backspace : false
});

// Generate colors
function getRandomColor() {
  function rand(min, max) {
    return min + Math.random() * (max - min);
  }

  var h = rand(1, 360) | 0,
  s = rand(40, 70) | 0,
  l = rand(65, 72) | 0;

  return 'hsl(' + h + ',' + s + '%,' + l + '%)';
}

function transformTag(tagData) {
  tagData.color = getRandomColor();
  tagData.style = "--tag-bg:" + tagData.color;
  tagData.value = proxy.CurrDate + " | " + proxy.CurrUser + ": " + tagData.value; //CurrDate & CurrUser are PHP sessions 
}

It's working perfectly.

image

The problem is when I go back to the registry to edit it. In this case, all observations are updated with the same date and the same operator name.

image

How could I get around this problem? I'm using it in jquery mode within PHPRunner.

Thanks!

コントリビューターガイド