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 2005/02/17 07:37:02 UTC
Processing a form's multi-select data with flow and JXTemplate
I have a (ordinary) form with multi-select field. The form's
data is then intercepted by a flow routine, and must then be
processed by a JXTemplate page.
In the form:
<select multiple="multiple" size="5" name="Year_pd">
In the flow page:
var Year_pd = cocoon.request.getParameter("Year_pd");
cocoon.sendPage("core-sql.xml", {"Year_pd":Year_pd} );
In the JXTemplate page:
<jx:forEach var="year" items="${Year_pd}">
<test>${year}</test>
</jx:forEach>
The problem is that this latter code throws a null pointer
exception when it is called.
Is there some special technique for processing this type
of data correctly?
Thanks
Derek
(Using Cocoon 2.1.5)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Processing a form's multi-select data with flow and JXTemplate
Posted by gioni <g....@cbim.it>.
Derek Hohls wrote:
>I have a (ordinary) form with multi-select field. The form's
>data is then intercepted by a flow routine, and must then be
>processed by a JXTemplate page.
>
>In the form:
>
><select multiple="multiple" size="5" name="Year_pd">
>
>
Multiple is a boolean value
<select multiple size="5" name="Year_pd">
>In the flow page:
>
>var Year_pd = cocoon.request.getParameter("Year_pd");
>
>
Are you sure that getParameter return an array or a list of value, try
print(Year_pd); to see the type.
Why don't you use a cocoon cform?
With cform is quite simple,
in definition file
<fd:multivaluefield id="year_pd">
<fd:label>Year</fd:label>
<fd:datatype base="integer"/>
<fd:validation>
<fd:value-count min="1"/>
</fd:validation>
<fd:selection-list>
<fd:item/>
</fd:selection-list>
</fd:multivaluefield>
in flowscript
var Year_pd = form.lookupWidget("year_pd").value;
this return an array of value
I hope this can help you
Bye Gioni
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org