The java script PopUp function wasn't working like it did under T3 so I started Googling for an answer. What I found was references to a "delegate" class. You are supposed to create a "block" (
I couldn't seem to figure this one out. You know I think the lack of Documentation effort in Tapestry was less of an issue when it used the interface model. But I'm keeping an open mind. Some things do seem easier (better?).
It seemed to me that the problem had to do with whitespace characters getting removed from the javascript. Line endings matter because...well it's not xml with close tags...it's javascript.
So I added the following property to my html tag: xml:space="preserve". No go. I messed with this for a good hour trying to determine why Tapestry was deleting the line ending right after the <!-- tag on the line above the first line of code. The browsers didn't like this:
<!-- function PopUp(page, size) {
In the end it became apparent that no matter how many line endings I put between the comment and the function lines, Tapestry was going to delete them and put them on one line. Even with that xml:space="preserve" thing T5 was still deleting those particular whitespace characters.
In the end I did get it working. All that was required was giving something for Tapestry to place after the <!-- characters. I added the characters // right after the <!--. This gave Tapestry something to screw with and since // marks the beginning of a comment limited to the remainder of the current line in javascript, it didn't have any affect on the script.
Here is what ended up working (Note the extra // slashes at the beginning):
<script type="text/javascript">
<!-- //
function PopUp(page, size) {
Npop = window_handle = window.open(page,'popupWindowName', size, 'status=no,toolbar=no,scrollbars=no');
}
//-->
</script>
As it turns out the xml:space="preserve" is not required. The script text doesn't get messed with by Tapestry except for that issue with the first line. I'm still going to leave the spaces in there for now so that I can more easily see what is being generated by T5.