cancel
Showing results for 
Search instead for 
Did you mean: 

using clipboard in webdynpro java 730

Former Member
0 Kudos

Hi Experts,

i have a textedit which contains a text. Now I want to put it onto the clipboard.

How can I achieve this in WebDynpro Java 730? Please post me sample code.

Thanks

guest000

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

Hi,

It would require Javascript or other means to access the clipboard, which is currently not possible in the WDJ framework

Answers (13)

Answers (13)

Former Member
0 Kudos

Hi,

ok, I managed to workaround this in the way that I have added an image that looks like a webdynpro button, and the application now copies the contents of a webdynpro textview to the clipboard.

This works perfectly in IE, I didn't yet tested in FF and other browsers.

Best Regards!

Former Member
0 Kudos

Hi,

ok, I managed to workaround this in the way that I use an image that looks like a webdynpro button, and the application now copies the contents of a webdynpro textview to the clipboard.

This works perfectly in IE, I didn't yet tested in FF and other browsers.

Best Regards!

Former Member
0 Kudos

i assume something like


 <nput type="image" src="image.png" alt="Submit button">

How can I show an image in wendynpro when using javascript via WebWidget?

Can you please help me in this?

Thank you! I appreciate your help!

Former Member
0 Kudos

My second question would be:

I could accept the workaround that I change the look and feel of the currently working javascript button that looks like a webdynpro button. For instance I could use an image that could behave like the javascript button.

Former Member
0 Kudos

Now my problem is that since the button is a javascript button, its look and feel differs from a webdynpro button.

I can invoke the javascript function CopyToClipboard() only if I use the onclick event of the javascript button (like in the above example).

OR: I can invoke the CopyToClipboard() javascript event if I use the scriptOnload parameter of the WebWidget. But this case it gets invoked right after my application starts (this is why it is onload I guess...)

My Problem and my first question is this:

Can I invoke this event only at onload? Can I invoke it later at any time, like for instance when I press a webdynpro button?

You know I would like to have a WD button like "Copy to Clipboard" that is invoking the javascript's function. I am not sure it is possible.

Former Member
0 Kudos

5. Regarding BBKM.CopyClbCompView.TextEdit: I figured out the javascript id of the TextEdit using HTTPWatch.

Former Member
0 Kudos

4. Obviously I have bound the value "html" to the parameter "html" of the WebWidget. This is what I initialize in the previous point.

If I deploy this app, then a javascript button "COPY" shows up and if I press that then my webdynpro TextEdit data is taken and put to the clipboard. Amost what I need.

Former Member
0 Kudos

3. Also in the wdDoInit() I add the code:

I specify the html parameter for the webwidget. I cannot post the entire code because SDN has parsing problems with it, but this is the important part of the javascript code:

window.clipboardData.setData ("Text", document.getElementById("BBKM.CopyClbCompView.TextEdit").value);

Former Member
0 Kudos

2. I specify some text for the TextEdit in the wdDoInit() like:


  wdContext.currentContextElement().setText("mytext");

Former Member
0 Kudos

Hi Robin,

I am almost there but it is still not perfect.

I can now put to the clipboard the text that is coming from my webdynpro TextEdit.

I do this way:

1. I add a WebWidget and a TextEdit to the layout. I have created 2 context elements, that are called "html" (for the WebWidget) and "text" (for the TextEdit).

Former Member
0 Kudos

SDN has some problem with my answer, I try to post my question in parts.

Former Member
0 Kudos

Hello Robin!

After checking in httpwatch, my Text edit is OPGD.MyAppCompView.TextEdit

...<tr><td ct="GLC" lsdata="{}" id="" class="" valign="BASELINE"><textarea class="urScrl urTedWhl lsNoResize urTedWhlEnbl" tabindex="0" ti="0" rows="5" cols="40" wrap="soft" id="OPGD.MyAppCompView.TextEdit" ct="TE" lsdata="" lsevents=",Change:{'urEventName':'TEXTEDITONCHANGE'}}" style="ime-mode:disabled;height:225px;width:500px;">----...

On this forum I can see some workaround using LinkToURL, but I would like to try WebWidget (especially because it is told there not to use this workaround, but after some research afaik WebWidget is exactly to use jscript and html), see this:

Here a similar hint is mentioned like

javascript:document.getElementById("KFHO.SomeView.InputField1").setAttribute("value",clipboardData.getData("Text"));

I don't know how exactly to use the WebWidget. Can you please give me some more hints? I would like to execute this "copy to clipboard" action once I click on a button.

Thank you very much I appreciate your help!

Qualiture
Active Contributor
0 Kudos

You 'might' get it to work if your button fires an event which will post a request to your web widget (or have it refreshed) and the code inside the web widget is then able to capture the content of your text edit UI element.

Simpler would be to have the button inside the web widget, so all handling is done inside the widget, but I can imagine this isné what you want

Former Member
0 Kudos

Thank you. How about WebWidget UI element?

Qualiture
Active Contributor
0 Kudos

Hi,

You could use the IWDWebWidget API to embed custom HTML or JavaScript, but it would require quite a bit of jiggery-pokery to retrieve the value of your text field; you have no direct access to WD-provisioned context elements and/or UI elements