Search code examples
javajavascriptcsstooltiptapestry

Display a javascript/css tooltip within a @For loop with Tapestry 4.0.1


I'm not at all familiar with Tapestry 4.0.1 and need to update a legacy application to display a formatted tooltip for a few links within a @For loop. What is the easiest/best way to go about accomplishing this? Should I be using the @Script component or is there a simpler way?

By the way, upgrading to a newer version of Tapestry is out of the question. Unfortunate, yes, but out of my control.

Thanks in advance for your help.

Carl


Solution

  • After posting my question, I managed to come up with a rather hacky (crappy?) solution. Can't say it's my proudest moment as a engineer, but it works.*

    <script type="text/javascript">
        function outputLink(value, tooltip) {
                document.write("<a href='#' onclick='return false;' onmouseover='showtip(event, \"" + tooltip + "\");' onmouseout='hidetip();'>" + value + "</a>");
            }
    </script>
    <span jwcid='@For'>
        <script type="text/javascript">
            outputLink("Foo", "<span jwcid="@Insert" value="ognl:foo.bar"/>");
        </script>
    </span>
    

    *Some code omitted to protect the innocent.