cancel
Showing results for 
Search instead for 
Did you mean: 

calling java script in view

Former Member
0 Kudos

Hi gurus,

I am stuck with some issu, here is my issue as fallows

Scenario:

I am planning to open outlook client by passing some java script and i want to attach history of the email like same as reply button in MSoutlook

- To call java script i am using webwidget UI element in WDJ and on action of button i am calling that java script like as fallows

String html = ReplyAll_class_j.callActiveXFromHTML(this.wdComponentAPI,"toemail", "fromAdd", "Subject of email", <html><body>htmlbody</body></html>);

wdContext.currentContextElement().setHtml(html);

- in java class i am passing some java script like as fallows

public static String callActiveXFromHTML(IWDComponent compAPI,String toMailAddress,String ccEmailAddress,String mailSubject,String htmlBody) {

Script is here

}

the Issue is when i click the button it is not opening the outlook client but it is doing when i am click on the tab to recall the component, I thought it is doing this because i am passing "this.wdComponentAPI" as a parameter, but i dont know other solutions so please help me in this issue

thanks in advance

Anu

Accepted Solutions (1)

Accepted Solutions (1)

srinivas_sistu
Active Contributor
0 Kudos

Hi,

I am not sure why is that statement "WE CANNOT CALL JS from WDJ"???? I did that pretty number of time in my developments. Can you please try the below mentioned way...

Inside your method what ever you write to open the JS window

String htmlcontent="Your HTML Content";

try

{

byte[] html=new byte [ 4096 ] ;

html=htmlcontent.getBytes("UTF-8");

wdContext.currentContextElement().setVaHTML(html);

IWDWindow win =wdThis.wdGetAPI().getComponent().getWindowManager()

.createNonModalExternalWindow(WDWebResource.getWebResource(html, WDWebResourceType.HTML).getURL(),"window Name As per your choice");

win.setWindowSize(600,600);

win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);

win.removeWindowFeature(WDWindowFeature.TOOL_BAR);

win.removeWindowFeature(WDWindowFeature.MENU_BAR);

win.show();

}

catch(WDURLException url)

{

wdComponentAPI.getMessageManager().reportException("WDURLException::"+url.toString(),true);

}

Regards,

SrinivaS

Former Member
0 Kudos

HI Srinivas,

Thank you for your reply it was really helpful answer it solved our problem, but i want to hide that window after running my java script, and also i found one more thing that this java script is alive because when i reload the page this outlook client is opening again, so is there any otherway to kill this after the event handling, please help me in this one srinivas, it will solve our problem and we can fix the isuue

Thanks

anu

Qualiture
Active Contributor
0 Kudos

In your html, after your JavaScript has executed, simply use window.close() to close the popup.

However, if you don't want a popup at all, a better approach would be to use a small WDIFrame component in your view, and have the HTML written to the iframe as needed.

Since a refresh of the view would also refresh the iframe and thus re-run the JavaScript, be sure to replace the embedded html with an empty html.

Robin

srinivas_sistu
Active Contributor
0 Kudos

Hi Anusha,

you can try the way Robin said...

In your html, after your JavaScript has executed, simply use window.close() to close the popup.

but remember one thing, dont go for IFrame as it is deprected.

Regards,

SrinivaS

Answers (1)

Answers (1)

Former Member
0 Kudos

In general we cann't call the JavaScript from Web Dynpro.

I would suggest u to develop the app in JSPDynpages, so that you can have the flexibility of calling javascripst etc.

Former Member
0 Kudos

HI Reddy,

Thanks for your suggestion but i never worked with JSP Dyne pages so would you please suggest me how to implement that and how to call to Webdynpro

Thanks

Anu

Former Member
0 Kudos

This message was moderated.