cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: [woody] initialize form control values
Date Sun, 15 Feb 2004 08:03:07 GMT
On Sun, 2004-02-15 at 06:50, Mark Lundquist wrote:
> On Feb 14, 2004, at 7:22 PM, Christopher Oliver wrote:
> 
>         Can't you just assign values to the widgets in yourflowscript?
> 
> OK.. coming back to this after a little rest, I realized that sincethe
> HTML form controls are generated by woody-field-styling.xsl, ifthere
> is any way to set, for instance, the 'value' attribute on an<input
> type="text"> control, this stylesheet must give me some clueabout it. 
> All right, so it turns out to come from <wi:value>.
> 
> The next clue was from a message I Googled up, indicating that what
> Ineed to do is say something like:
> 
> form.getWidget("some-widget-id").setValue ("Whatever");

Here you are using Woody's Java API in flowscript, which isn't
necessarily wrong, but there's also an alternative. See the file
woody_flow_example.js:

var model = form.getModel();
model.somewidgetid = "Whatever";

And then there's also the "v2" woody-flowscript integration which is
similar but more powerful.

Currently the Java API is probably the most stable though.
 
> 
> I never saw this in the on-line docs or the Wiki, and if it was in
> thesamples, then I missed it.

Getting and setting the value of a form widget is about the most
essential operation you can do with a form (next to letting it process a
form submit), and could indeed use some more prominent place in the
documentation and/or samples since I've noticed confusion about this
before.

>   OK, sure enough, grepping for 'setValue' Isee that it is indeed in
> the samples, and if I hadseen it there I would have seen yet another
> example of how to set thevalue: embedded <javascript> in the form
> definition.
> 
> All right, then.  I think I've got enough to go on for now — thx a
> lot.
> 
> Until My Next Question,
> — Mark
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@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