You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kalle Korhonen <ka...@gmail.com> on 2008/04/25 01:18:28 UTC

Re: EventListener and PropertySelection (Solution)

I just run into the same exact thing, using Tap 4.1.5, dojo that comes with
it, propertyselection and an eventlistener as well as prototype. Anybody
know if this is fixed in a newer snapshot, if there is a bug open on this or
any (better) workaround?

Kalle

On Sat, Oct 27, 2007 at 9:41 AM, lt <li...@gmail.com> wrote:

>
> Ok after looking into this. It appears to be a conflict with DOJO and
> Prototypte.  the isNode method in dojo check to see if Element is of type
> function and then compare it to the object.  I am not willing to give up
> prototype for this, so i just commented out this section of the code in
> /dojo-0.4.3/src/dom.js and everything is working nicely.  Is there any
> reason why I shouldn't do this?
>
> Regards,
> LT
>
>
>
> lt wrote:
> >
> > Hello,
> >
> > Im having some trouble with the EventListener annotation and
> > PropertySelection component.  I am using Tap 4.1.3.  Here is the
> mappings.
> >
> >    @Component(id="reportTypeSelect", type="PropertySelection", bindings={
> >                           "displayName=literal:Report Type",
> >
> > "model=@com.example.reports.Report@REPORT_TYPE_MODEL",
> >                           "value=reportType"
> >                              })
> >     public abstract PropertySelection getReportTypeSelect();
> >
> >     @EventListener(events={"onchange"}, targets="reportTypeSelect",
> > submitForm="reportForm")
> >     public void onChangeReportType(IRequestCycle cycle) {
> >         System.out.println("HERE");
> >     }
> >
> >
> > On the page, the JS is loaded and the event is mapped via dojo but when I
> > change the select from one value to another i get this JS exception.
> >
> > DEBUG: [Error: buildTargetProperties() Unknown target type:[object
> > HTMLSelectElement], file:
> > http://localhost:8081/assets/static/dojo-0.4.3/dojo.js, line: 96] when
> > calling formEvent1730950492$joinpoint$method on [object Object] with
> > arguments [object Object]
> > FATAL exception raised: buildTargetProperties() Unknown target
> > type:[object HTMLSelectElement]
> >
> > What am I missing?
> >
>
> --
> View this message in context:
> http://www.nabble.com/EventListener-and-PropertySelection-tf4699964.html#a13444950
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: EventListener and PropertySelection (Solution)

Posted by Kalle Korhonen <ka...@gmail.com>.
Here's a solution that's still a bit ugly but at least a little less drastic
than commenting out parts of Dojo... Override dojo.dom.isNode in your code
as follows:
dojo.dom.isNode=function(wh){
  if(typeof Element=="function"){
    try{
      //return wh instanceof Element;
      return Object.isElement(wh);
    }
    catch(e){}
  }else return wh&&!isNaN(wh.nodeType);
};

Obviously, you could move this to core Tapestry and check for existence of
isElement() first to make it work whether or not prototype exists. Not sure
though this is probably worth solving - don't know if there are that many
users out there using T4, dojo and prototype.

Kalle


On Thu, Apr 24, 2008 at 4:18 PM, Kalle Korhonen <ka...@gmail.com>
wrote:

> I just run into the same exact thing, using Tap 4.1.5, dojo that comes with
> it, propertyselection and an eventlistener as well as prototype. Anybody
> know if this is fixed in a newer snapshot, if there is a bug open on this or
> any (better) workaround?
>
> Kalle
>
>
> On Sat, Oct 27, 2007 at 9:41 AM, lt <li...@gmail.com> wrote:
>
>>
>> Ok after looking into this. It appears to be a conflict with DOJO and
>> Prototypte.  the isNode method in dojo check to see if Element is of type
>> function and then compare it to the object.  I am not willing to give up
>> prototype for this, so i just commented out this section of the code in
>> /dojo-0.4.3/src/dom.js and everything is working nicely.  Is there any
>> reason why I shouldn't do this?
>>
>> Regards,
>> LT
>>
>>
>>
>> lt wrote:
>> >
>> > Hello,
>> >
>> > Im having some trouble with the EventListener annotation and
>> > PropertySelection component.  I am using Tap 4.1.3.  Here is the
>> mappings.
>> >
>> >    @Component(id="reportTypeSelect", type="PropertySelection",
>> bindings={
>> >                           "displayName=literal:Report Type",
>> >
>> > "model=@com.example.reports.Report@REPORT_TYPE_MODEL",
>> >                           "value=reportType"
>> >                              })
>> >     public abstract PropertySelection getReportTypeSelect();
>> >
>> >     @EventListener(events={"onchange"}, targets="reportTypeSelect",
>> > submitForm="reportForm")
>> >     public void onChangeReportType(IRequestCycle cycle) {
>> >         System.out.println("HERE");
>> >     }
>> >
>> >
>> > On the page, the JS is loaded and the event is mapped via dojo but when
>> I
>> > change the select from one value to another i get this JS exception.
>> >
>> > DEBUG: [Error: buildTargetProperties() Unknown target type:[object
>> > HTMLSelectElement], file:
>> > http://localhost:8081/assets/static/dojo-0.4.3/dojo.js, line: 96] when
>> > calling formEvent1730950492$joinpoint$method on [object Object] with
>> > arguments [object Object]
>> > FATAL exception raised: buildTargetProperties() Unknown target
>> > type:[object HTMLSelectElement]
>> >
>> > What am I missing?
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/EventListener-and-PropertySelection-tf4699964.html#a13444950
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>