Tagify mixed mode change format posted data

881 Views Asked by At

I use Tagify to add autocompletion in a textarea mixed with text and send the value to the server when the form is submitted and this works great. But i would like to change the way the tags are included in the submitted data.

Tagify is smart enough to convert the textarea data into tags mixed with regular text:

<textarea name="test" type="text">Hello [[James]]! </textarea>

But when i submit the form is get

Hello [[{"value":"James"}]]!

I have made an example on jsfiddle

If i make a Tagify without mode: 'mix' and use the setting:

originalInputValueFormat: valuesArr => valuesArr.map(item => item.value).join(',')

then the output matches the input as expected.( [[James]] and not [[{"value":"James"}]] )

What must i do to get Tagify to change it's output?

1

There are 1 best solutions below

0
On

The developer of Tagify solved my problem by adding originalInputValueFormat for the mix mode. My example now works as expected!

I only had to update Tagify to version 4.13.0 and add the following code to the constructor:

originalInputValueFormat: tagData => tagData.value,