What have you done so far to diagnose this problem?

For example, if I were dealing with this (I often do) I start by
checking that the page, and the JavaScript, rendered as I expected.

I'd then check the browser console for errors.

I'd also set breakpoints in my JS code to see if and when it is executed.

When debugging, you always want to go from a position of certainty to
another position of certainty. This requires you to gather facts as
you go.

On Tue, Jun 5, 2012 at 11:54 PM, yeehuqiu <yeehu...@gmail.com> wrote:
> with tapestry5.3. I have some codes
> eg:
> package com.ailk.mapp.tapestry.app.mixins;
>
> import org.apache.tapestry5.BindingConstants;
> import org.apache.tapestry5.ClientElement;
> import org.apache.tapestry5.annotations.AfterRender;
> import org.apache.tapestry5.annotations.Import;
> import org.apache.tapestry5.annotations.InjectContainer;
> import org.apache.tapestry5.annotations.Parameter;
> import org.apache.tapestry5.ioc.annotations.Inject;
> import org.apache.tapestry5.services.javascript.JavaScriptSupport;
>
> @Import (library="confirm.js")
> public class Confirm {
>
>        @Parameter(value = "Are you sure?", defaultPrefix =
> BindingConstants.LITERAL)
>        private String message;
>        @Inject
>        private JavaScriptSupport javaScriptSupport;
>        @InjectContainer
>        private ClientElement element;
>        @AfterRender
>        public void afterRender() {
>
>                System.out.println("--------confirm----------");
>        javaScriptSupport.addScript("new Confirm('%s', '%s');",
> element.getClientId(), message);
>        }
> }
>
> Confirm.java 's path is
> /mapp/src/main/java/com/ailk/mapp/tapestry/app/mixins/Confirm.java
> and confirm.js's code
>
> var Confirm = Class.create();
> Confirm.prototype = {
>        initialize: function(element, message) {
>
>                        alert("=====confirm====js====")
>                this.message = message;
>                Event.observe($(element), 'click',
> this.doConfirm.bindAsEventListener(this));
>        },
>
>        doConfirm: function(e) {
>                if(! confirm(this.message))
>                        e.stop();
>        }
> }
>
> confirm.js 's path is
> /mapp/src/main/*resources*/com/ailk/mapp/tapestry/app/mixins/confirm.js
>
> when I user them in my page .but it doesn't work .
> <input t:type="submit" value="delete" t:mixins="confirm" t:message="Are you
> sure you want to delete this item?"   />.
> where is my problem. why it doesn't work?
> thanks in advance!
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/a-problem-about-tapestry5-s-minxins-tp5713655.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to