0

In pop up window i am selecting some values and clicking on submit button where i am calling the submit method from bean. In bean i am setting the value of a variable. My problem is how i can pass this bean value in a javascript and display the same in my parent window.

pop up window code

<h:commandButton value="#{bundle['submit']}" action="#{searchBean.submit}"
    onclick="postDataToParent()">
    </h:commandButton>
<input type="text" id="searchvalue" value="#{searchBean.StatusDTO.searchResults}"  /> 

javascript method in pop up window

<script language="javascript">
function postDataToParent(){
var x=document.getElementById("searchvalue").value;
window.opener.document.confirmation['confirmation:searchResults'].value = x;
window.opener.document.confirmation['confirmation:searchResults'].focus();
alert(x);
//window.opener.location.reload();
window.close();
 } 
</script>

parent window code. I have to display the pop up window value in this text area

<td width="70%">
<a4j:region id="namesearch">
<h:inputTextarea id="searchResults"       value="#Bean.StatusDTO.searchResults}"
 rows="10" cols="50" required="true">
<a4j:support event="onchange" reRender="searchResultsMessage"
id="searchResultsSupport" />
</h:inputTextarea> 
<h:commandLink  onclick="javascript:window.open('NameSearchPopUp.jsf','', 'width=600,height=500,scrollbars=yes,left=250,top=1,resizable=1');return false;" immediate="true" value="Name Search" />                    
</a4j:region>
</td>
Akshatha
  • 599
  • 2
  • 10
  • 26
  • INMO you better use jquery UI dialogs instead of opening windows... that way it will be much much easier to achive your goal and the user experience will be much better... look at this http://stackoverflow.com/a/9439565/617373 – Daniel Mar 28 '12 at 07:53
  • Why don't you just use RichFaces' ``/``? – BalusC Mar 28 '12 at 12:37
  • @BalusC: can u provide me some eg or links for using it will be of great help to me – Akshatha Mar 28 '12 at 12:42

0 Answers0