user2930538
user2930538

Reputation: 131

popup in JSF to set it value in parent Window

I have written a button onClick to open popup window. The window has a table with a commandLink in each row. How to populate the parent page textbox on click of commandLink in child page?

Upvotes: 0

Views: 1096

Answers (1)

Metalhead89
Metalhead89

Reputation: 1910

You can give the commandLink an ajax tag, with whom you render your parent textbox. Use something like this:

<h:inputText id="parentTextboxId" value="#{bean.text}" />

<rich:popupPanel domElementAttachment="form" show="#{bean.showPopup}" modal="true">

    <h:commandLink value="My Link">
        <f:ajax render=":mainForm:parentTextboxId" listener="#{bean.changeText}" />
    </h:commandLink>

</rich:popupPanel>

In the bean method bean#changeText the value of the textbox will be changed, but you can also do it elsewhere, like in the action method of your commandLink

Upvotes: 1

Related Questions