Copy and Paste Notes Field

Home Forums Classic DFFS Copy and Paste Notes Field

Viewing 4 reply threads
  • Author
    Posts
    • #16557
      Bryan Waldrop
      Participant

        I am using DFFS to “auto document” selections made in the form to the notes field by using the Set field value in rules.

        At the completion of the form I would like to offer the user an option button the selects all of the notes and copies to clipboard for pasting into another system.

        I have the button setup and appearing on the form ready to run the custom JS function.

        <input id="btnNumber1" class="customBtn" type="button" value="Copy Notes" onclick="copytext()">

        But I am not sure what the function copytext() would look like for Call_x0020_Notes?

        Any ideas?

        • This topic was modified 7 years, 6 months ago by Bryan Waldrop.
      • #16609
        Bryan Waldrop
        Participant

          Found this clipboardjs
          Looks promising but have still not been able to figure out how to pass field value to it.

        • #16611
          Bryan Waldrop
          Participant

            I created a button associated with a function:

            <input id="btnNumber1" class="customBtn" type="button" value="Copy Notes" onclick="copytext()">

            It is easy enough to create a function placing the field value in a variable

            
            
            function copytext(){
            var notes = getFieldValue("Call_x0020_Notes");
            }

            I got the developer Zeno to comment that the imperative API would be the way to go.

            clipboard.js / demo / function-target.html

            But I am not sure what to do it with it.
            Any ideas?

            • This reply was modified 7 years, 6 months ago by Bryan Waldrop.
          • #16620
            Bryan Waldrop
            Participant

              Ended up not using the clipboardjs. This worked for me.

              
              
              //copytoclipboard
              function copyNotesToClip()
              		{
              			
                                      var txtNotes = getFieldValue('Call_x0020_Notes');
              		
              			if( window.clipboardData && window.clipboardData.setData ) {
              			   window.clipboardData.setData("Text", txtNotes);
              			}
              		}
              
              $(spjs.dffs.fields["Call_x0020_Notes"]).find('.ms-formbody').append("<button class='customBtn' onclick='copyNotesToClip();return false'>Copy Notes</button>"); 
            • #16624
              Alexander Bautz
              Keymaster

                I’m glad you figured it out – I have a bit to much at the moment so I’m falling behind on the follow-up.

                Best regards,
                Alexander

            Viewing 4 reply threads
            • You must be logged in to reply to this topic.