You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by "Ian.Priest" <Ia...@opsera.com> on 2006/07/10 15:05:24 UTC

Popup windows and Clay

Hi,

I think this question is probably about 50% Clay and 50% JSF, so I'll
start by asking on it this list.

I have a requirement to open a link in a popup window. What I'd like to
do is have the link as a Clay component and open the popup with the
result of clicking on the link. I have an actionlink widget:

    <!-- Widget definition -->
    <component jsfid="widgetsActionLink" extends="commandLink"
allowBody="false">
            <attributes>
                    <set name="action" value="@command" />
                    <set name="immediate" value="@immediate"/>
            </attributes>
       
            <element jsfid="outputText" renderId="0">
                    <attributes>
                            <set name="value"
value="#{messages['@managed-bean-name.@command']}" />
                    </attributes>
            </element>
    </component>


This allows me to define the whole link as a Clay component and get the
displayed text from a message bundle. 

    <!-- HTML -->
    <a jsfid="widgetsActionLink" command="alink" immediate="true"
href="#">somelink</a>


Unfortunately I can't see a way of using this type of link to open a
popup as I'm not sure what url to provide to the window.open() function.
What I'd like to do in onclick is something like:

    <a jsfid="widgetsActionLink" comand="alink" immediate="true"
onclick="window.open(href, 'popup',
'width=500,height=310,scrollbars=yes');" href="#">somelink</a>
        

where href is the result of clicking on the link.

At the moment I use a fixed <a> tag with a jsfid="ignore" to stop it
being processed:

<span jsfid="ignore"><a href="somepage.html">A Link</a></span>

Unfortunately this means I can't render out the displayed text from a
message bundle, and the link destination is hard-coded into my page -
both less than ideal!

Can anyone help me out with a solution?

Cheers,
Ian.