You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eric Schneider <er...@centralparksoftware.com> on 2005/04/01 23:48:22 UTC

Body.addInitializationScript()

Hi,

I'm wondering where in the request cycle it is appropriate to add some 
javascript initialization code to my Body component?

Following needs to be tucked into the window.onload on every page:

onLoadHandler();

Also, I need this to work on pages that use Tapestry's validation stuff 
(which also makes use of window.onload).    Any tips on how I can get 
this done?

Thanks,
e.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Body.addInitializationScript()

Posted by Jamie <ja...@dang.com>.
have a look at the DTD for the .script files. There is a command to 
place code into the body onload event. You just include your script 
compenent and the rest happens for you.

Jamie

Eric Schneider wrote:

> Hi,
>
> I'm wondering where in the request cycle it is appropriate to add some 
> javascript initialization code to my Body component?
>
> Following needs to be tucked into the window.onload on every page:
>
> onLoadHandler();
>
> Also, I need this to work on pages that use Tapestry's validation 
> stuff (which also makes use of window.onload).    Any tips on how I 
> can get this done?
>
> Thanks,
> e.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Body.addInitializationScript()

Posted by Eric Schneider <er...@centralparksoftware.com>.
Totally worked.  Thank you Jamie!

e.

On Apr 1, 2005, at 5:18 PM, Jamie wrote:

> the dtd says you don't need a body tag (0 or 1)
> :
> <!ELEMENT script (include-script*, input-symbol*,
>    (let | set)*, body?, initialization?)>
>
> Eric Schneider wrote:
>
>> Can I accomplish this using a Script component?  Could it be as 
>> simple as this?
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE script PUBLIC
>>         "-//Apache Software Foundation//Tapestry Script Specification 
>> 3.0//EN"
>>         "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
>>
>> <script>
>>   <initialization>
>>     onLoadHandler();
>>   </initialization>
>> </script>
>>
>> Can you have a script component without a <body> defined?
>>
>> Thanks,
>> e.
>>
>> On Apr 1, 2005, at 4:48 PM, Eric Schneider wrote:
>>
>>> Hi,
>>>
>>> I'm wondering where in the request cycle it is appropriate to add 
>>> some javascript initialization code to my Body component?
>>>
>>> Following needs to be tucked into the window.onload on every page:
>>>
>>> onLoadHandler();
>>>
>>> Also, I need this to work on pages that use Tapestry's validation 
>>> stuff (which also makes use of window.onload).    Any tips on how I 
>>> can get this done?
>>>
>>> Thanks,
>>> e.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: 
>>> tapestry-user-help@jakarta.apache.org
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Body.addInitializationScript()

Posted by Jamie <ja...@dang.com>.
the dtd says you don't need a body tag (0 or 1)
:
<!ELEMENT script (include-script*, input-symbol*,
    (let | set)*, body?, initialization?)>

Eric Schneider wrote:

> Can I accomplish this using a Script component?  Could it be as simple 
> as this?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE script PUBLIC
>         "-//Apache Software Foundation//Tapestry Script Specification 
> 3.0//EN"
>         "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
>
> <script>
>   <initialization>
>     onLoadHandler();
>   </initialization>
> </script>
>
> Can you have a script component without a <body> defined?
>
> Thanks,
> e.
>
> On Apr 1, 2005, at 4:48 PM, Eric Schneider wrote:
>
>> Hi,
>>
>> I'm wondering where in the request cycle it is appropriate to add 
>> some javascript initialization code to my Body component?
>>
>> Following needs to be tucked into the window.onload on every page:
>>
>> onLoadHandler();
>>
>> Also, I need this to work on pages that use Tapestry's validation 
>> stuff (which also makes use of window.onload).    Any tips on how I 
>> can get this done?
>>
>> Thanks,
>> e.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Body.addInitializationScript()

Posted by Eric Schneider <er...@centralparksoftware.com>.
Can I accomplish this using a Script component?  Could it be as simple 
as this?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script PUBLIC
         "-//Apache Software Foundation//Tapestry Script Specification 
3.0//EN"
         "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">

<script>
   <initialization>
     onLoadHandler();
   </initialization>
</script>

Can you have a script component without a <body> defined?

Thanks,
e.

On Apr 1, 2005, at 4:48 PM, Eric Schneider wrote:

> Hi,
>
> I'm wondering where in the request cycle it is appropriate to add some 
> javascript initialization code to my Body component?
>
> Following needs to be tucked into the window.onload on every page:
>
> onLoadHandler();
>
> Also, I need this to work on pages that use Tapestry's validation 
> stuff (which also makes use of window.onload).    Any tips on how I 
> can get this done?
>
> Thanks,
> e.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>