variable to clipboard

mbuitenkamp-4316
mbuitenkamp-4316 Community Member Posts: 13 ☆ Roadie ☆
Hi all,

I'm looking for a way to copy the text from an entryfield to the clipboard, and combine it with a little bit of text of my own.

So, someone puts text in entryfield_1, that text gets stored in variable_1, and then with an onMouseClick I want that text and my own text copied to the clipboard, so it can be pasted into a document.

Any way of doing this?

Cheers in advance :)

Comments

  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 574 eLearning ROCKSTAR Admin Team
    I've recently done something similar. I'm including an example that has a button and an entry field.

    It puts content into the entry field using a Change Contents action, then it runs some JavaScript to copy it to the clipboard.

    Hopefully it will be easy to understand, you need to Page Preview or Publish it for it to work.

    - Joe

    @mbuitenkamp.4316 (see the post below)
  • mbuitenkamp-4316
    mbuitenkamp-4316 Community Member Posts: 13 ☆ Roadie ☆
    Thank you for wanting to help!
    However, when I import the pkg, all I see is a blank page?
  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 574 eLearning ROCKSTAR Admin Team
    It was blank, not sure how that happened.

    It also needed some updates, so it's a good thing. It will work on either Desktop or Online now.

    Thanks

    Joe
  • mbuitenkamp-4316
    mbuitenkamp-4316 Community Member Posts: 13 ☆ Roadie ☆
    awesome!! I got it to work in my document! Thank you!

    but... (of course there's a but), I need the entryfield to be multiline since we're asking users to create a list.
    that isn't a problem, until I paste the contents from the clipboard and the neat little list just ends up as one very long single line.

    so this:

    item 1
    item 2
    item 3

    becomes this:

    item 1item 2item 3
    Can that be fixed???
  • mbuitenkamp-4316
    mbuitenkamp-4316 Community Member Posts: 13 ☆ Roadie ☆
    edited to match my document, so you can see what's going on :)
  • mbuitenkamp-4316
    mbuitenkamp-4316 Community Member Posts: 13 ☆ Roadie ☆
    found it!

    it was actually just a matter of making the 'Set To Update Clipboard' to multiline as well.

    Yay, I'm so happy!
    thank you :D:D:D
  • mbuitenkamp-4316
    mbuitenkamp-4316 Community Member Posts: 13 ☆ Roadie ☆
    okay, last question:
    it works when the entryfield is single line, but it doesn't work when the entryfield is multiline

    The variable gets set into the entryfield for copy, but in multiline the text doesn't get selected, and so it doesn't get copied.
    Which is a shame because I really do need a multiline solution.

    Any idea how to fix this?

    tia :)
  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 574 eLearning ROCKSTAR Admin Team
    Hi Tia,

    That's great you are figuring it out!

    You need to change the execute copy script to use 'textarea' instead of 'input' see attachment

    Joe
  • mbuitenkamp-4316
    mbuitenkamp-4316 Community Member Posts: 13 ☆ Roadie ☆
    perfect!

    thanks a million :)