Skip to Content
0

WebWidget in Webdynpro Java Does not work.

Oct 05, 2017 at 09:17 AM

28

avatar image
Former Member

Hi experts,

I try to embed my javascript by using WebWidget. If I put my piece of code in wdDoInit(), it works fine. But If I call this in an event ( when a buttom is triggered), then nothing shows up.

StringBuffer buffer = new StringBuffer(); 
buffer.append("<div id=\"panel\"></div>"); 
buffer.append("<script>"); 
buffer.append("var str = \"Hello Test.\";"); 
buffer.append("genode(str, \'panel\');"); 
buffer.append("function genode(str, id) {"); 
buffer.append("alert(str);");
buffer.append("}"); 
buffer.append("</script>"); 
wdContext.currentContextElement().setExportHTMLString(buffer.toString());

If I simply put the following code in my event, Javascript can be called successfully.

StringBuffer buffer = new StringBuffer();  
buffer.append("<input type=button onclick='JavaScript:window.print()' name='b1' value='print>");
wdContext.currentContextElement().setExportHTMLString(buffer.toString());

Somehow I find out that the system does not buy

buffer.append("<script>"); 

OR

buffer.append("<script type = \"text/javascript\">")

Please kindly guide me the correct direction.

thanks,

zita

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers