Set Header portlet CAF element values from body portlet

Hi All,

  1. My web page is comprised of Header portlet, body portlet and footer portlet (in a shell).

    Could you please advise, depending on user actions in body portlet, how can I set values to CAF elements present in Header portlet?

    My intended functionality is given below. (But below code is not working in body portlet - as it is not able to identify control with id headerPortletElementControlId which is present in header portlet)

	javascript in body portlet:
	if(true){
		CAF.model('#{activePageBean.clientIds["headerPortletElementControlId"]}').setValue('New Value');
	}

Set Parent portlet CAF element value from child portlet
2) Depending on user actions in a child window, how can I set values to CAF elements present in Parent window?

I would have achieved this functionality in JSP pages with below code. Could you please advise how to achieve the same in the portlets designed with CAF elements.
	window.opener.document.getElementById('parentJSPPageElementControlId').value = 'New Value';

Kind regards,
Raja sekhar Kintali

Please see the ‘External Portlet References’ section on page 195 of the CAF Development Help documentation from http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_sp2/Designer/8-2-SP1_CAF_Development_Help.pdf

Hi Rajasekhar,
For point 1 the code snipped you have written should work as we’ve done it in our application.
As a test, please use the getValue() method to see the current value. If the getValue methods throws a java script error that the object is not found.
View the html source of the IE page and search for the control id whether it exists or not.

For point 2

  1. In the parent page, drag and drop a script control.
  2. Write a javascript function which takes the inputs and sets the inputs to whatever controls on the parent page.
  3. Once an action is invoked in the child window, make a call to the function in the parent window as below

Please let me know if this helps or you need a working sample.

Regards,
Sravan

Hi Eric,

Thanks for the link. Helpful in resolving issue # 1.

Hi Sravan,

For Issue # 1: This code works when one portlet(Header) is imported into another portlet(Body). But In my case, Header, Body and footer portlets are defined in a shell. In HTML source, I can see the element id defined. A dirty fix for this issue can be to iterate over all the DOM elements and find the id that matches to the element id that we require and get / set the values. But I don’t want to iterate over all the DOM elements.

For Issue # 2: Thanks for your inputs on this issue. Now am able to manipulate elements of a parent portlet based on the actions done on child portlet.

Kind regards,
Raja sekhar Kintali

Hi Raja Sekhar,
Good to hear that both of your issues are resolved.
For issue# 1: How was this resolved? Did you do wiring between the body and the header portlets?
Alternatively you can try a similar approach which you implemented for issue# 2.

Regards,
Sravan