You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bruce Petro <bp...@artromick.com> on 2007/04/12 22:12:23 UTC

T5 simple javascript question

I'm hearing that T5 javascript support is not fully implemented -
question - is it ready to handle a simple call like this?  IE: when the
button is pressed, it will first perform some local javascript, then
continue on with the submit process.  Does that work? If so, I must not
have the correct tapestry-javascript syntax because I'm not getting the
alert happening. Does this onClick need some reference to the scoping of
page or something like that?

 

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<head>

<title>Reports</title>

<SCRIPT LANGUAGE="JavaScript">

<!--

  function buttonClick(aString) {

alert("ping");

return true;

  }

-->

</SCRIPT>

</head>

 

  <body>

     <t:form t:id="doReportsForm" action="reportsForm">

       <t:submit t:id="doReportsButton" name="Run Report" 

value="Run Report" onClick="buttonClick('Submit')"/>

     </t:form>

  </body>

</html>

 


Re: T5 simple javascript question

Posted by Alexandru Dragomir <al...@gmail.com>.
Not sure why it didn't work . Maybe try to put your function inside <body/>.

I tried this small sample (javascript function is also inside body ) and it
worked :

<script>
 function test_script() {
     alert("test");
 }
</script>

    <t:form>
        <t:submit t:id="test" onClick="test_script();"/>
    </t:form>


Cheers ,
Alex

On 4/12/07, Bruce Petro <bp...@artromick.com> wrote:
>
> I'm hearing that T5 javascript support is not fully implemented -
> question - is it ready to handle a simple call like this?  IE: when the
> button is pressed, it will first perform some local javascript, then
> continue on with the submit process.  Does that work? If so, I must not
> have the correct tapestry-javascript syntax because I'm not getting the
> alert happening. Does this onClick need some reference to the scoping of
> page or something like that?
>
>
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
> <head>
>
> <title>Reports</title>
>
> <SCRIPT LANGUAGE="JavaScript">
>
> <!--
>
>   function buttonClick(aString) {
>
> alert("ping");
>
> return true;
>
>   }
>
> -->
>
> </SCRIPT>
>
> </head>
>
>
>
>   <body>
>
>      <t:form t:id="doReportsForm" action="reportsForm">
>
>        <t:submit t:id="doReportsButton" name="Run Report"
>
> value="Run Report" onClick="buttonClick('Submit')"/>
>
>      </t:form>
>
>   </body>
>
> </html>
>
>
>
>