You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2007/06/07 14:27:08 UTC
Styling an fd:multivaluefield item?
Hi
The thread:
http://marc.info/?l=xml-cocoon-users&m=117879407932600&w=2
refers...
The basic question, which was not clearly answered there is "how
to add *standard* form attributes to an fd:item for an
fd:multivaluefield?
The example could be:
<fd:multivaluefield id="Test">
<fd:label>TEST</fd:label>
<fd:datatype base="boolean"/>
<fd:selection-list
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
<fd:item value="13020711"><fd:label>foo</fd:label></fd:item>
<fd:item value="19120623" />
<fd:item value="19690721" />
<fd:item value="19700506"/>
</fd:selection-list>
</fd:multivaluefield>
In my case, the above item list is actually generated dynamically
via a call to:
<fd:selection-list src="cocoon:/db/etc/etc" dynamic="true"/>
The fd:multivaluefield will be styled as a multi-select checkbox,
in the form:
<input title="foo" name="bar" value="13020711" type="checkbox">
etc.
What ALSO needs to appear on the final form is the attribute:
checked="true"
on any number of the input checkboxes. Ideally, this should be
done by adding an attribute to the fd:item element. In the
previous thread, some argued this is a "styling" activity - in fact,
this is only partially the case - the "true" attribute is inherently
tied
to the value, and is created at the same time as it (during the
dynamic generation process). The styling process in fact takes
place later when the "true" property of the item is converted to
checked="true" .
Any thoughts on how to streamline this process would be
appreciated.
Derek
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Derek Hohls <DH...@csir.co.za>.
Baptiste
I thought I explained my problem quite well :)
The core issue is that each item essentially needs two key properties:
* a numeric (or text) value
* a true/false status
The first "value" has to be styled as an input box "value" attribute; the
second has to be styled as an input box "checked=true/false" attribute.
The current fd:form definition does not allow me to add the true/false
status property to an item definition - or, if it does, I am not clear how.
Does this make more sense?
Derek
>>> Baptiste Placé <bo...@free.fr> 2007/06/07 05:33:15 PM >>>
Derek,
I dont understand well your problem, where do you want to process the
checked attribute ?
Maybe you could use some JS DOM scripting to add those attributes. I
can't give you much advice on form generators :(
-Baptiste
Derek Hohls a écrit :
> Hi
>
> The thread:
> http://marc.info/?l=xml-cocoon-users&m=117879407932600&w=2
> refers...
>
> The basic question, which was not clearly answered there is "how
> to add *standard* form attributes to an fd:item for an
> fd:multivaluefield?
>
> The example could be:
> <fd:multivaluefield id="Test">
> <fd:label>TEST</fd:label>
> <fd:datatype base="boolean"/>
> <fd:selection-list
> xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
> <fd:item value="13020711"><fd:label>foo</fd:label></fd:item>
> <fd:item value="19120623" />
> <fd:item value="19690721" />
> <fd:item value="19700506"/>
> </fd:selection-list>
> </fd:multivaluefield>
>
> In my case, the above item list is actually generated dynamically
> via a call to:
> <fd:selection-list src="cocoon:/db/etc/etc" dynamic="true"/>
>
> The fd:multivaluefield will be styled as a multi-select checkbox,
> in the form:
> <input title="foo" name="bar" value="13020711" type="checkbox">
> etc.
>
> What ALSO needs to appear on the final form is the attribute:
> checked="true"
> on any number of the input checkboxes. Ideally, this should be
> done by adding an attribute to the fd:item element. In the
> previous thread, some argued this is a "styling" activity - in fact,
> this is only partially the case - the "true" attribute is inherently
> tied
> to the value, and is created at the same time as it (during the
> dynamic generation process). The styling process in fact takes
> place later when the "true" property of the item is converted to
> checked="true" .
>
> Any thoughts on how to streamline this process would be
> appreciated.
>
> Derek
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Baptiste Placé <bo...@free.fr>.
Derek,
I dont understand well your problem, where do you want to process the
checked attribute ?
Maybe you could use some JS DOM scripting to add those attributes. I
can't give you much advice on form generators :(
-Baptiste
Derek Hohls a écrit :
> Hi
>
> The thread:
> http://marc.info/?l=xml-cocoon-users&m=117879407932600&w=2
> refers...
>
> The basic question, which was not clearly answered there is "how
> to add *standard* form attributes to an fd:item for an
> fd:multivaluefield?
>
> The example could be:
> <fd:multivaluefield id="Test">
> <fd:label>TEST</fd:label>
> <fd:datatype base="boolean"/>
> <fd:selection-list
> xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
> <fd:item value="13020711"><fd:label>foo</fd:label></fd:item>
> <fd:item value="19120623" />
> <fd:item value="19690721" />
> <fd:item value="19700506"/>
> </fd:selection-list>
> </fd:multivaluefield>
>
> In my case, the above item list is actually generated dynamically
> via a call to:
> <fd:selection-list src="cocoon:/db/etc/etc" dynamic="true"/>
>
> The fd:multivaluefield will be styled as a multi-select checkbox,
> in the form:
> <input title="foo" name="bar" value="13020711" type="checkbox">
> etc.
>
> What ALSO needs to appear on the final form is the attribute:
> checked="true"
> on any number of the input checkboxes. Ideally, this should be
> done by adding an attribute to the fd:item element. In the
> previous thread, some argued this is a "styling" activity - in fact,
> this is only partially the case - the "true" attribute is inherently
> tied
> to the value, and is created at the same time as it (during the
> dynamic generation process). The styling process in fact takes
> place later when the "true" property of the item is converted to
> checked="true" .
>
> Any thoughts on how to streamline this process would be
> appreciated.
>
> Derek
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Joerg Heinicke <jo...@gmx.de>.
On 08.06.2007 10:17, Derek Hohls wrote:
> PS : re the database call issue " you usually keep all possible
> values in one table and the n:m association between
> objects and these values in another one."
>
> This is true; but a RIGHT JOIN (or LEFT JOIN) will return possible
> AND linked values in a single SQL statement.
The retrieval of possible and actual values are two different issues and
should be separated as it is done in Cocoon. The possible values are
part of the form model (and so fd:item) while the actual values are part
of the data model (and so they become a form instance).
Even retrieving them in one statement is not a good idea. It's not
replaceable with an O/R mapper since you don't place the possible values
in the domain object. What about creating a new instance of such an
object. How to retrieve the possible values if there are no actual
values in the database? And imagine a repeater. Do you want to retrieve
the possible values for each entry in the repeater?
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Derek Hohls <DH...@csir.co.za>.
Solved!
Found I was using:
<fd:datatype base="boolean"/>
rather than:
<fd:datatype base="string"/>
in the:
<fd:multivaluefield> definition.
Sorry....
>>> "Derek Hohls" <DH...@csir.co.za> 2007/06/08 10:17 AM >>>
Johannes
I am still struggling with the transformation step:
when I have input like this
<fd:item value="TEST"><fd:label>Test Label</fd:label></fd:item>
It seems to arrive at the styling step (ie. BEFORE the HTML is
created) with the value being set to "false" ?
The only place I can see that this might happen is in the:
<map:transform type="forms">
step.
Any idea why text values are being transformed to "true/false:"
values?
Thanks
Derek
PS : re the database call issue " you usually keep all possible
values in one table and the n:m association between
objects and these values in another one."
This is true; but a RIGHT JOIN (or LEFT JOIN) will return possible
AND linked values in a single SQL statement.
>>> Johannes Textor <jc...@gmx.de> 2007/06/08 10:00 AM >>>
Derek,
>
> Thanks; that is clearer. Am I correct in assuming that the :
> <fi:values>
> <fi:value>1</fi:value>
> <fi:value>3</fi:value>
> </fi:values>
> will be displayed as "checked input boxes" with a:
> <fi:styling list-type="checkbox"/>
>
I don't really know, since I do not use the "default" CForms
stylesheets, instead I normally create my own. It would certainly make
sense if that happened, though :)
>
> I still do not understand the rationale for this; this approach
> effectively means two sets of calls to the database to generate the
> output (1) to create the *possible* values as fd:item, and (2) to
> create the values which appear as fi:item. While doing the first
> is straightforward, doing the second will mean placing another
> database call inside of the flowscript, yes?
>
(2) appear as fi:value (not fi:item, those are simply the same as
fd:item), but I assume that was what you meant. Yes, two calls to the
database are needed - but that's normal, isn't it ? I mean, you
usually
keep all possible values in one table and the n:m association between
objects and these values in another one.
Actually, it is possible to do both from flowscript with the following
syntax:
<fd:multivaluefield id="language">
<fd:label>Select language:</fd:label>
<fd:datatype base="integer"/>
<fd:selection-list id="language" type="flow-jxpath"
list-path="language" value-path="id" label-path="name"/>
</fd:multivaluefield>
and then in Flowscript:
var list;
list.language = new java.util.Vector();
list.language.add(getAllLanguagesFromDatabase());
/* For it to work, allLanguagesFromDatabase() must return a list of
POJOs that implement the methods getId() and getName() */
var form = new Form("formdef.xml");
var model = form.getModel();
model.languages[0] = 1;
model.languages[1] = 3;
form.showForm("my-form", list);
>
> Thanks again for the clear code explanation! An example like this
in
> the docs would be great.
>
> Derek
>
I agree that the docs on multivaluefields are more than sparse;
checking
quickly, I did not find anything in the wiki either. Did not check the
samples, though, I guess there is one which covers this.
Cheers,
Johannes
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message is subject to the CSIR's copyright, terms and conditions
and
e-mail legal notice. Views expressed herein do not necessarily
represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and
the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject
line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by
MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Derek Hohls <DH...@csir.co.za>.
Johannes
I am still struggling with the transformation step:
when I have input like this
<fd:item value="TEST"><fd:label>Test Label</fd:label></fd:item>
It seems to arrive at the styling step (ie. BEFORE the HTML is
created) with the value being set to "false" ?
The only place I can see that this might happen is in the:
<map:transform type="forms">
step.
Any idea why text values are being transformed to "true/false:"
values?
Thanks
Derek
PS : re the database call issue " you usually keep all possible
values in one table and the n:m association between
objects and these values in another one."
This is true; but a RIGHT JOIN (or LEFT JOIN) will return possible
AND linked values in a single SQL statement.
>>> Johannes Textor <jc...@gmx.de> 2007/06/08 10:00 AM >>>
Derek,
>
> Thanks; that is clearer. Am I correct in assuming that the :
> <fi:values>
> <fi:value>1</fi:value>
> <fi:value>3</fi:value>
> </fi:values>
> will be displayed as "checked input boxes" with a:
> <fi:styling list-type="checkbox"/>
>
I don't really know, since I do not use the "default" CForms
stylesheets, instead I normally create my own. It would certainly make
sense if that happened, though :)
>
> I still do not understand the rationale for this; this approach
> effectively means two sets of calls to the database to generate the
> output (1) to create the *possible* values as fd:item, and (2) to
> create the values which appear as fi:item. While doing the first
> is straightforward, doing the second will mean placing another
> database call inside of the flowscript, yes?
>
(2) appear as fi:value (not fi:item, those are simply the same as
fd:item), but I assume that was what you meant. Yes, two calls to the
database are needed - but that's normal, isn't it ? I mean, you usually
keep all possible values in one table and the n:m association between
objects and these values in another one.
Actually, it is possible to do both from flowscript with the following
syntax:
<fd:multivaluefield id="language">
<fd:label>Select language:</fd:label>
<fd:datatype base="integer"/>
<fd:selection-list id="language" type="flow-jxpath"
list-path="language" value-path="id" label-path="name"/>
</fd:multivaluefield>
and then in Flowscript:
var list;
list.language = new java.util.Vector();
list.language.add(getAllLanguagesFromDatabase());
/* For it to work, allLanguagesFromDatabase() must return a list of
POJOs that implement the methods getId() and getName() */
var form = new Form("formdef.xml");
var model = form.getModel();
model.languages[0] = 1;
model.languages[1] = 3;
form.showForm("my-form", list);
>
> Thanks again for the clear code explanation! An example like this
in
> the docs would be great.
>
> Derek
>
I agree that the docs on multivaluefields are more than sparse;
checking
quickly, I did not find anything in the wiki either. Did not check the
samples, though, I guess there is one which covers this.
Cheers,
Johannes
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Derek Hohls <DH...@csir.co.za>.
Johannes
Follow-up to post prior to this one - you said:
var model=form.getModel();
model.language[0] = 1;
In my code, when I try do this, I get a
java.lang.NullPointerException.
starting off:
at
org.apache.cocoon.forms.flow.javascript.ScriptableWidget.has(ScriptableWidget.java:96)
at
org.mozilla.javascript.ScriptRuntime.setElem(ScriptRuntime.java:1050)
at
org.mozilla.javascript.Interpreter.do_setElem(Interpreter.java:2705)
....
Derek
>>> Johannes Textor <jc...@gmx.de> 2007/06/08 10:00 AM >>>
Derek,
>
> Thanks; that is clearer. Am I correct in assuming that the :
> <fi:values>
> <fi:value>1</fi:value>
> <fi:value>3</fi:value>
> </fi:values>
> will be displayed as "checked input boxes" with a:
> <fi:styling list-type="checkbox"/>
>
I don't really know, since I do not use the "default" CForms
stylesheets, instead I normally create my own. It would certainly make
sense if that happened, though :)
>
> I still do not understand the rationale for this; this approach
> effectively means two sets of calls to the database to generate the
> output (1) to create the *possible* values as fd:item, and (2) to
> create the values which appear as fi:item. While doing the first
> is straightforward, doing the second will mean placing another
> database call inside of the flowscript, yes?
>
(2) appear as fi:value (not fi:item, those are simply the same as
fd:item), but I assume that was what you meant. Yes, two calls to the
database are needed - but that's normal, isn't it ? I mean, you usually
keep all possible values in one table and the n:m association between
objects and these values in another one.
Actually, it is possible to do both from flowscript with the following
syntax:
<fd:multivaluefield id="language">
<fd:label>Select language:</fd:label>
<fd:datatype base="integer"/>
<fd:selection-list id="language" type="flow-jxpath"
list-path="language" value-path="id" label-path="name"/>
</fd:multivaluefield>
and then in Flowscript:
var list;
list.language = new java.util.Vector();
list.language.add(getAllLanguagesFromDatabase());
/* For it to work, allLanguagesFromDatabase() must return a list of
POJOs that implement the methods getId() and getName() */
var form = new Form("formdef.xml");
var model = form.getModel();
model.languages[0] = 1;
model.languages[1] = 3;
form.showForm("my-form", list);
>
> Thanks again for the clear code explanation! An example like this
in
> the docs would be great.
>
> Derek
>
I agree that the docs on multivaluefields are more than sparse;
checking
quickly, I did not find anything in the wiki either. Did not check the
samples, though, I guess there is one which covers this.
Cheers,
Johannes
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Johannes Textor <jc...@gmx.de>.
Derek,
>
> Thanks; that is clearer. Am I correct in assuming that the :
> <fi:values>
> <fi:value>1</fi:value>
> <fi:value>3</fi:value>
> </fi:values>
> will be displayed as "checked input boxes" with a:
> <fi:styling list-type="checkbox"/>
>
I don't really know, since I do not use the "default" CForms
stylesheets, instead I normally create my own. It would certainly make
sense if that happened, though :)
>
> I still do not understand the rationale for this; this approach
> effectively means two sets of calls to the database to generate the
> output (1) to create the *possible* values as fd:item, and (2) to
> create the values which appear as fi:item. While doing the first
> is straightforward, doing the second will mean placing another
> database call inside of the flowscript, yes?
>
(2) appear as fi:value (not fi:item, those are simply the same as
fd:item), but I assume that was what you meant. Yes, two calls to the
database are needed - but that's normal, isn't it ? I mean, you usually
keep all possible values in one table and the n:m association between
objects and these values in another one.
Actually, it is possible to do both from flowscript with the following
syntax:
<fd:multivaluefield id="language">
<fd:label>Select language:</fd:label>
<fd:datatype base="integer"/>
<fd:selection-list id="language" type="flow-jxpath"
list-path="language" value-path="id" label-path="name"/>
</fd:multivaluefield>
and then in Flowscript:
var list;
list.language = new java.util.Vector();
list.language.add(getAllLanguagesFromDatabase());
/* For it to work, allLanguagesFromDatabase() must return a list of
POJOs that implement the methods getId() and getName() */
var form = new Form("formdef.xml");
var model = form.getModel();
model.languages[0] = 1;
model.languages[1] = 3;
form.showForm("my-form", list);
>
> Thanks again for the clear code explanation! An example like this in
> the docs would be great.
>
> Derek
>
I agree that the docs on multivaluefields are more than sparse; checking
quickly, I did not find anything in the wiki either. Did not check the
samples, though, I guess there is one which covers this.
Cheers,
Johannes
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Derek Hohls <DH...@csir.co.za>.
Johannes
Thanks; that is clearer. Am I correct in assuming that the :
<fi:values>
<fi:value>1</fi:value>
<fi:value>3</fi:value>
</fi:values>
will be displayed as "checked input boxes" with a:
<fi:styling list-type="checkbox"/>
I still do not understand the rationale for this; this approach
effectively means two sets of calls to the database to generate the
output (1) to create the *possible* values as fd:item, and (2) to
create the values which appear as fi:item. While doing the first
is straightforward, doing the second will mean placing another
database call inside of the flowscript, yes?
Thanks again for the clear code explanation! An example like this in
the docs would be great.
Derek
>>> Johannes Textor <jc...@gmx.de> 2007/06/08 09:09 AM >>>
Derek,
I think Joerg is making the following point: In the form *definition*,
you just define the set of *possible* values for a field, e.g.:
<fd:multivaluefield id="language">
<fd:label>Select language</fd:label>
<fd:datatype base="integer"/>
<fd:selection-list>
<fd:item value="1"><fd:label>english</fd:label></fd:item>
<fd:item value="2"><fd:label>german</fd:label></fd:item>
<fd:item value="3"><fd:label>french</fd:label></fd:item>
</fd:selection-list>
</fd:multivaluefield>
Then which fields are actually selected depends on the object you're
editing, i.e., must be set in the form's *model*. In flowscript:
var form = new Form("formdef.xml");
var model = form.getModel();
model.languages[0] = 1;
model.languages[1] = 3;
form.showForm("my-form");
This will yield the following form *instance*:
<fi:multivaluefield id="language">
<fi:label>Select language</fi:label>
<fi:values>
<fi:value>1</fi:value>
<fi:value>3</fi:value>
</fi:values>
<fi:selection-list>
<fi:item value="1"><fi:label>english</fi:label></fi:item>
<fi:item value="2"><fi:label>german</fi:label></fi:item>
<fi:item value="3"><fi:label>french</fi:label></fi:item>
</fi:selection-list>
</fi:multivaluefield>
So there is no need for a "selected="true"" or similar attribute on the
items of the selection list.
Cheers,
Johannes
Derek Hohls wrote:
> Joerg
>
> Sorry, what you are saying is very unclear to me... I have given
> code examples of what I want to achieve - if you could show me
> code examples of how to do this, then understanding would be
> achieved!
>
> (I have tried to explain again in another post what it is I am
> trying to get to.)
>
> Derek
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Johannes Textor <jc...@gmx.de>.
Derek,
I think Joerg is making the following point: In the form *definition*,
you just define the set of *possible* values for a field, e.g.:
<fd:multivaluefield id="language">
<fd:label>Select language</fd:label>
<fd:datatype base="integer"/>
<fd:selection-list>
<fd:item value="1"><fd:label>english</fd:label></fd:item>
<fd:item value="2"><fd:label>german</fd:label></fd:item>
<fd:item value="3"><fd:label>french</fd:label></fd:item>
</fd:selection-list>
</fd:multivaluefield>
Then which fields are actually selected depends on the object you're
editing, i.e., must be set in the form's *model*. In flowscript:
var form = new Form("formdef.xml");
var model = form.getModel();
model.languages[0] = 1;
model.languages[1] = 3;
form.showForm("my-form");
This will yield the following form *instance*:
<fi:multivaluefield id="language">
<fi:label>Select language</fi:label>
<fi:values>
<fi:value>1</fi:value>
<fi:value>3</fi:value>
</fi:values>
<fi:selection-list>
<fi:item value="1"><fi:label>english</fi:label></fi:item>
<fi:item value="2"><fi:label>german</fi:label></fi:item>
<fi:item value="3"><fi:label>french</fi:label></fi:item>
</fi:selection-list>
</fi:multivaluefield>
So there is no need for a "selected="true"" or similar attribute on the
items of the selection list.
Cheers,
Johannes
Derek Hohls wrote:
> Joerg
>
> Sorry, what you are saying is very unclear to me... I have given
> code examples of what I want to achieve - if you could show me
> code examples of how to do this, then understanding would be
> achieved!
>
> (I have tried to explain again in another post what it is I am
> trying to get to.)
>
> Derek
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Derek Hohls <DH...@csir.co.za>.
Joerg
Sorry, what you are saying is very unclear to me... I have given
code examples of what I want to achieve - if you could show me
code examples of how to do this, then understanding would be
achieved!
(I have tried to explain again in another post what it is I am
trying to get to.)
Derek
>>> Joerg Heinicke <jo...@gmx.de> 2007/06/08 08:26:53 AM >>>
On 07.06.2007 14:27, Derek Hohls wrote:
> The thread:
> http://marc.info/?l=xml-cocoon-users&m=117879407932600&w=2
> refers...
>
> The basic question, which was not clearly answered there is "how
> to add *standard* form attributes to an fd:item for an
> fd:multivaluefield?
> What ALSO needs to appear on the final form is the attribute:
> checked="true"
> on any number of the input checkboxes. Ideally, this should be
> done by adding an attribute to the fd:item element. In the
> previous thread, some argued this is a "styling" activity - in fact,
> this is only partially the case - the "true" attribute is inherently
> tied to the value, and is created at the same time as it (during
the
> dynamic generation process).
This is not a styling attribute at all, but a *value*. That means you
have to set the value on the form field, but *not* on the fd:item. It
is
possible to set an initial value in the form field - the actual values,
so text, not true/false.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Styling an fd:multivaluefield item?
Posted by Joerg Heinicke <jo...@gmx.de>.
On 07.06.2007 14:27, Derek Hohls wrote:
> The thread:
> http://marc.info/?l=xml-cocoon-users&m=117879407932600&w=2
> refers...
>
> The basic question, which was not clearly answered there is "how
> to add *standard* form attributes to an fd:item for an
> fd:multivaluefield?
> What ALSO needs to appear on the final form is the attribute:
> checked="true"
> on any number of the input checkboxes. Ideally, this should be
> done by adding an attribute to the fd:item element. In the
> previous thread, some argued this is a "styling" activity - in fact,
> this is only partially the case - the "true" attribute is inherently
> tied to the value, and is created at the same time as it (during the
> dynamic generation process).
This is not a styling attribute at all, but a *value*. That means you
have to set the value on the form field, but *not* on the fd:item. It is
possible to set an initial value in the form field - the actual values,
so text, not true/false.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org