Jump to content

execCommand


picyka

Recommended Posts

  with btnCopiarResumo, JSInterface do
    JSAddListener('click', JSFunction('sender', 'var textarea = document.getElementById(' + UniMemoResumo.JSName + '.inputId); '
      + 'textarea.select(); '
      + 'document.execCommand(''copy'');'));

Currently I use this routine to copy text from a memo, it works very well. I would like that,

when the person clicked on the button, before I copied the text,

I could go to the server, and feed the memo, I would have to execute it on the server before executing the JS click.

 

can i do it?

Link to comment
Share on other sites

function click(sender, e, eOpts)
{
  Ext.defer(function(){
        ajaxRequest(sender, '_beforeClick', [])
    }, 5);

  var textarea = document.getElementById(UniMemoResumo.JSName + '.inputId);
  textarea.select();
  document.execCommand(''copy'');
}

Before copying the text of the memo, I need to feed it.

Link to comment
Share on other sites

1 hour ago, picyka said:
function click(sender, e, eOpts)
{
  Ext.defer(function(){
        ajaxRequest(sender, '_beforeClick', [])
    }, 5);

  var textarea = document.getElementById(UniMemoResumo.JSName + '.inputId);
  textarea.select();
  document.execCommand(''copy'');
}

Before copying the text of the memo, I need to feed it.

Try

with copy_but, JSInterface do
    JSAddListener('click', JSFunction('sender', 'var textarea = document.getElementById(' + unimemo1.JSName + '.inputId); '
      + 'textarea.value=textarea.value.trim(); '
      + 'textarea.select(); '
      + 'document.execCommand(''copy'');'));
 

Seems to work.

Link to comment
Share on other sites

36 minutes ago, Roberto Nicchi said:

Try

with copy_but, JSInterface do
    JSAddListener('click', JSFunction('sender', 'var textarea = document.getElementById(' + unimemo1.JSName + '.inputId); '
      + 'textarea.value=textarea.value.trim(); '
      + 'textarea.select(); '
      + 'document.execCommand(''copy'');'));
 

Seems to work.

I need to set the text to the memo, before executing the click, I would like to do this in the button itself.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...