You'll know for sure if the script is being included by viewing the
generated html of your page. If you see that the script is included, then
copy and paste the url pointing to it..If you can't see the js source from
the url then the path might be wrong.
On 2/27/06, Brian Long <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I've been working on a @KeyBoard component, which will be similar to the
> the
> DatePicker component in that it will be attached to a textfield and allow
> users to enter text by selecting the buttons displayed on the screen (we
> will be deployed the project to a touchscreen).
>
> To cut a long story short after looking at the tapestry DatePicker
> component
> and shamelessly copying it, I have a small problem, it doesn't work. Hours
> of debugging later I'm of the opinion that the javascript file
> KeyBoard.jsisn't being read/or can't be found.
>
> To simplify matters I created a Message component whose only function is
> to
> display a message - alert("Some Message"). I created the Message.js and
> the
> equivalent Message.jwc, Message.script, Message.java etc. Again, no cigar.
>
> When the function is placed on my page, it can be called, when put in my
> Message.js, might as well be on the moon, the page is pointing at it but
> it
> can't be found . . .
>
> Here is what I'm using . . .
>
> Message.js
> function doSomething() {
>
> alert("Some Message");
>
> }
>
> Message.script
> <?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>
>
> <include-script resource-path="Message.js"/>
>
> <let key="buttonOnclickHandler">
> javascript:doSomething();
> </let>
>
> </script>
>
> Message.jwc
> <!DOCTYPE component-specification PUBLIC
> "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
>
> <component-specification class="com.myCompany.myProject.web.jwc.Message"
> allow-body="no">
>
> <parameter name="value" required="yes"/>
> <parameter name="disabled"/>
> <parameter name="icon" default-value="asset:defaultIcon"/>
>
> <parameter name="displayName"/>
> <parameter name="validators"/>
> <parameter name="id" property="idParameter" default-value="id"/>
>
> <asset name="defaultIcon" path="images/keypad/Message.png"/>
>
> <inject property="script" type="script" object="Message.script"/>
> <inject property="validatableFieldSupport" object="service:
> tapestry.form.ValidatableFieldSupport"/>
>
> </component-specification>
>
> Message.java is a copy and paste of DatePicker.java with value changed
> from
> Date to String
>
> The <include-script resource-path="Message.js"/> from Message.script is
> annoying as I can't give an explicit path to the javascript to make sure
> of
> where it's looking for the script, it appends "/myProject/WEB-INF/jwc/"
> before any absolute paths I try to place in there.
>
> BTW, my .script, js and jwc files are in the same folder which is (no
> surprise) "/myProject/WEB-INF/jwc/" and yes I have included the component
> in
> the myProject.application file in WEB-INF.
>
> Regards, Brian.
>
>