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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to