You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mark Lundquist <ml...@wrinkledog.com> on 2004/02/15 03:13:54 UTC

[woody] initialize form control values

D'oh!

How can I generate initial values for form controls generated by 
widgets (so that I can "pre-populate" a form)?

Thanks,
-- Mark


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


Re: [woody] initialize form control values

Posted by Antonio Gallardo <ag...@agssa.net>.
Mark Lundquist dijo:
> Hi Antonio,
>
> On Feb 14, 2004, at 6:24 PM, Antonio Gallardo wrote:
>
>> A default value property for widget is a future feature.
>
> Well -  phooey.
>
>>  By now all you
>> can do is:
>>
>> Use binding framework with a Bean with the "pre-populated values".
>
> OK.  That means that I must either (a) figure out how to emulate
> binding one form to two beans, per our other thread; or, (b) write a
> special-purpose bean class to serve as a proxy for the two real model
> beans.

We already did a similar approach for (b) but for other reasons. I think
it is the best approach in this case.

Best Regards,

Antonio Gallardo

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


Re: [woody] initialize form control values

Posted by Mark Lundquist <ml...@wrinkledog.com>.
Hi Antonio,

On Feb 14, 2004, at 6:24 PM, Antonio Gallardo wrote:

> A default value property for widget is a future feature.

Well -  phooey.

>  By now all you
> can do is:
>
> Use binding framework with a Bean with the "pre-populated values".

OK.  That means that I must either (a) figure out how to emulate 
binding one form to two beans, per our other thread; or, (b) write a 
special-purpose bean class to serve as a proxy for the two real model 
beans.

(b) would be a kludge, so if (a) is for real I'd sure like to 
understand the details!

Many thanks,
-- Mark

Re: [woody] initialize form control values

Posted by Antonio Gallardo <ag...@agssa.net>.
Mark Lundquist dijo:
> D'oh!
>
> How can I generate initial values for form controls generated by
> widgets (so that I can "pre-populate" a form)?

A default value property for widget is a future feature. By now all you
can do is:

Use binding framework with a Bean with the "pre-populated values".

Best Regards,

Antonio Gallardo


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


Re: [woody] initialize form control values

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Feb 15, 2004, at 12:03 AM, Bruno Dumon wrote:

> On Sun, 2004-02-15 at 06:50, Mark Lundquist wrote:
>>
>> 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";

Ah, well that is nicer.

And both ways I like better than embedding <javascript> in the 
<wd:form>, which is mixing imperativeness into what was a nice 
declarative thing.

Thx-a-lot,
— Mark


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


Re: [woody] "v2" flow integration (was Re: initialize form control values)

Posted by Bruno Dumon <br...@outerthought.org>.
On Sun, 2004-02-15 at 12:12, Mark Lundquist wrote:
> On Feb 15, 2004, at 12:03 AM, Bruno Dumon wrote:
> 
> > <..snip..>
> >
> > And then there's also the "v2" woody-flowscript integration which is
> > similar but more powerful.
> 
> Is there a summary somewhere of the differences between v2, and uh... 
> "v1"? :-)

Here's some info on v2:
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=107531818111033&w=2

> 
> It looks like in v2, the javascript createBinding() would just be 
> called from the flow, is that right?  (no more <map:call 
> function="woody", right?)

I'd do the same with v1. I always create Form objects myself (like in
the sample on the wiki), not relying on the "woody" function. I don't
see any advantage in the woody function. The Woody samples should be
adjusted in this regard.

-- 
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


[woody] "v2" flow integration (was Re: initialize form control values)

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Feb 15, 2004, at 12:03 AM, Bruno Dumon wrote:

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

Is there a summary somewhere of the differences between v2, and uh... 
"v1"? :-)

It looks like in v2, the javascript createBinding() would just be 
called from the flow, is that right?  (no more <map:call 
function="woody", right?)

— Mark


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


Re: [woody] initialize form control values

Posted by Bruno Dumon <br...@outerthought.org>.
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


Re: [woody] initialize form control values

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Feb 14, 2004, at 7:22 PM, Christopher Oliver wrote:

> Can't you just assign values to the widgets in your flowscript?

OK.. coming back to this after a little rest, I realized that since the 
HTML form controls are generated by woody-field-styling.xsl, if there 
is any way to set, for instance, the 'value' attribute on an <input 
type="text"> control, this stylesheet must give me some clue about 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 I 
need to do is say something like:

	form.getWidget("some-widget-id").setValue ("Whatever");

I never saw this in the on-line docs or the Wiki, and if it was in the 
samples, then I missed it.  OK, sure enough, grepping for 'setValue' I 
see that it is indeed in the samples, and if I had seen it there I 
would have seen yet another example of how to set the value: 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

Re: [woody] initialize form control values

Posted by Christopher Oliver <re...@verizon.net>.
Can't you just assign values to the widgets in your flowscript?

Mark Lundquist wrote:

> D'oh!
>
> How can I generate initial values for form controls generated by 
> widgets (so that I can "pre-populate" a form)?
>
> Thanks,
> -- 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