[ http://issues.apache.org/jira/browse/COCOON-1916?page=all ]

Carsten Ziegeler reassigned COCOON-1916:
----------------------------------------

    Assignee: Carsten Ziegeler

> viewData is undefined in event handler when event is triggered outside 
> showForm/sendPageAndWait
> -----------------------------------------------------------------------------------------------
>
>                 Key: COCOON-1916
>                 URL: http://issues.apache.org/jira/browse/COCOON-1916
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Forms
>    Affects Versions: 2.1.8, 2.1.9, 2.1.10-dev (current SVN)
>            Reporter: Rob Berens
>         Assigned To: Carsten Ziegeler
>            Priority: Minor
>
> When calling a java script snippet defined in the form description file, 
> viewData is passed in the context as long as viewData is available from the 
> objectModel and is not null. This makes it difficult to reliably use viewData 
> in the snippet. Consider the case where you create a form and then 
> dynamically assign some values to some widgets before actually showing the 
> form. This results in value-changed events to be fired with viewData 
> undefined in the context of the listener. Then using viewData in the snippet 
> results in a reference error. If the event is fired from a sendPageAndWait 
> context, viewData is neatly passed.
> The problem is how to distinguish this in the event handler. It would be 
> better to always pass viewData be it a null value some times. Then a simple 
> test viewData == null could be used in the event handler. Note that viewData 
> is also null when sendPageAndWait is called with only one parameter.
> This problem occurs on line 69 in 
> o.a.c.forms.event.impl.JavaScriptWidgetListener.java.
> Is this a bug or is there some intentional use?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to