Hello,

I create a component which used @EventListener, like this

public abstract class MonthDay extends BaseComponent implements 
PageBeginRenderListener {

    public abstract void setMonthModel(IPropertySelectionModel model);

    public abstract int getMonth();

    public abstract void setDayModel(IPropertySelectionModel model);

    public abstract int getDay();

    @Override
    public void pageBeginRender(PageEvent event) {
        ...
        prepare IPropertySelectionModel ...
        ...
    }

    @EventListener(targets = "month", events = "onchange")
    public void updateDayOptions(IRequestCycle cycle) {
        
cycle.getResponseBuilder().updateComponent(getComponent("day").getClientId());
    }

}

I use this custom component "twice" in one page.

And the first component which id is "month" works fine when the event 
"onchange" trigger, but the second component which id is "month_0" nothing 
happen.

I view the page source found something like this

tapestry.cleanConnect(dojo.byId("month"), 
                                     "onchange", "formEvent605878525");
                tapestry.formEvent605878525=function(e){
                    var content={beventname:"onchange", bcomponentid:"month"};
                    tapestry.event.buildEventProperties(e, content, arguments);
                    if (!content["beventtarget.id"]){
                        content["beventtarget.id"]="month";
                    }
                    
                   var validateState=tapestry.form.forms["form"].validateForm;
                   var validateForm=false;
                   tapestry.form.setFormValidating("form", validateForm);
                   
                    
                    tapestry.form.submitAsync("form", content);
                    
                    
                    
                    tapestry.form.setFormValidating("form", validateState);
                    
                };
                dojo.event.connect(dojo.byId("month"), "onchange",
                                   tapestry, "formEvent605878525");

and not found anything about "month_0"

How to generate javascript code like month's with "month_0" or how to use 
component which include @EventLIstener "twice"

I used tapestry 4.1.3

thanks in advance,

Jack
-- 
View this message in context: 
http://n2.nabble.com/%40EventListener-inside-custom-component-tp2567844p2567844.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to