cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <res1c...@verizon.net>
Subject Re: Need help w/ <wd:action> (and flowscript)
Date Wed, 10 Mar 2004 02:04:28 GMT
There is a "v2" version of the Woody flowscript API that allows you to 
do this:

function blah() {
    var form = new Form(...);
    var button = form.getWidget("doSomething-button");
    button.onClick = function() {
         doSomething();
    }
    form.showForm(...);
}

Using this API you can achieve the same behavior as is possible with 
javascript snippets in the form definition, but you also have access to 
the application data available in your flowscript.

See the sample under samples/woody/v2.

Regards,

Chris

Mark Lundquist wrote:

> Today I'm trying to move my application to Cocoon 2.1.4, and I'm 
> trying out some of the new stuff.  In particular, I'm having trouble 
> getting <wd:action> to work.
>
> Problem #1:  Validation is being triggered when I click my action 
> widget.  I didn't think that was possible with an action widget, but 
> apparently I've found a way :-/, or maybe I just didn't understand 
> this part.
>
> Problem #2:  The action for my widget needs visibility to objects that 
> are local to the caller of showForm(), and I can't figure out how to 
> get the right visibility inside the <on-action> javascript snippet.
>
> I tried this flowscript:
>
>     function blah() {
>     .
>     .
>         var doSomething = function() {
>                 // whatever
>             }
>         form.form.setAttribute ("doSomething", doSomething);
>         form.showForm()
>     .
>     .
>     }
>
> ...and this in the form definition file:
>
>     <wd:action id="doSomething-button" action-command="doSomething">
>         <wd:label>Do something!</wd:label>
>         <wd:on-action>
>             <javascript>
>                 event.getSourceWidget().getForm().doSomething();
>             <javascript>
>         </wd:on-action>
>     </wd:action>
>
> ...but Rhino says "doSomething is not a function" (actually, if I log 
> the value I see that it's undefined).
>
> So...
>     — what am I doing wrong?
>     — am I making this harder than it really is, or what?
>     — how do people use these action widgets, anyway?  seems like 
> needing to access the scope of the calling function would be a common 
> pattern...
>
> Thanks a lot,
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message