Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing to tagify textarea #294

Closed
lee-matthews opened this issue Sep 6, 2019 · 5 comments
Closed

Writing to tagify textarea #294

lee-matthews opened this issue Sep 6, 2019 · 5 comments

Comments

@lee-matthews
Copy link

lee-matthews commented Sep 6, 2019

Hi,

I can save the the contents of my tagify text area using :

document.getElementById(ElementId).value;

However, I'd also like to be able to write the previously saved data to the tagify textarea. I've tried setting document.getElementById(ElementId).value but this doesn't work.

Could you please explain how to do this?

Thanks again
Lee

@yairEO
Copy link
Owner

yairEO commented Sep 6, 2019

Can you make a demo page showing what you're trying to do?
Use this is a template: https://jsbin.com/degobup/edit?html,js,output

@lee-matthews
Copy link
Author

lee-matthews commented Sep 7, 2019 via email

@yairEO
Copy link
Owner

yairEO commented Sep 11, 2019

Is this related this this ticket?

#292

@lee-matthews
Copy link
Author

Thanks for getting back to me @yairEO

This request was more about reading and writing to a tagified text area more than using a database.

Thanks to a comment from Dinosaur Burger, I managed to write data back to the tagify textarea using - var commentHtml= tagify.parseMixTags(replyVal); //turns tags back into html.

You can find my modifications here
https://jsbin.com/dofejejuha/edit?html,js,output

What I notice however is that if the same tag is repeated, when it is written back into the textarea, the second second isn't displayed properly - it shows something like this instead : {"value":"lee","title":"lee"}

How can I get parseMixTags to work properly when duplicate tags are used?

Thanks again.

@yairEO
Copy link
Owner

yairEO commented Oct 14, 2019

@lee-matthews you need to parse the value first (using JSON.parse):

commentHtml= tagify.parseMixTags(  JSON.parse(databaseField.value)  )

@yairEO yairEO closed this as completed Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants