On Mar 9, 2004, at 1:14 PM, I 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).
Aha, it worked when I wrote this in the <on-action> snippet:
var doSomething = event.getSourceWidget().getForm().getAttribute ("doSomething");
doSomething();
...and once I got that straightened out, the spurious validation problem took care of itself as well!
I'd still be interested to know if I'm doing this in the "normative" way, or if there's some better way that I've missed...
Thanks, Mark
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
