How to insert plain static text and control characters into a dmx-bind:value

Hi, I made great progress last night and this AM - I have been trying to build a button on my web page that copies certain variables to the clipboard when pressed. I have that part working and I can stuff in any amount of variables I like onto the clipboard.

Is it possible to insert additional static text into the bind statement. I want to form readable statements and right now the values are just stuck together in one long string when I paste them (top of third photo)?

Also, I want to hide the text input box but when I do (like in the code and second photo) - it does not copy to the clipboard anymore.

Help Needed!

2018-10-06_05-50-42

2018-10-06_07-05-42

2018-10-06_07-00-39

1 Like

12 hours later - boy this is harder than I though it should be…

PMGIF

You need to use a textarea if you want to preserve new lines. Also browsers don’t allow to select text from hidden elements.

Solution:

<textarea
  id="myInput"
  dmx-bind:value="'Sugar ' + form1.sugar.value + '\nNOTES:\n' + form1.notes.value + '\nDate Mixed ' + form1.fatemixed.value"
  rows="1"
  cols="2"
  style="position:absolute; top:0; left:-500px;"
></textarea>

I made the textarea very small and positioned it outside the viewport so that it will not be visible on the site.

2 Likes

Thank you, thank you, thank you - I have been trying to make that work all day. Now with a bit of formatting I can get it to do exactly what I want. So cool…

PS. I hereby anoint you a Wappler Superstar!

Superstar

2 Likes