are you sure the .script file is being rendered?, or is that just the
problem, that it isn't?
you have to specifically do that, see the datepicker as example - try
debuggin and see if the code that renders the script is being executed.
you can either do it by code (java) or by embedding a <script component
in your template -
hope that helps,
Ron
Brian Long 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]