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/05/31 12:29:44 UTC
Processing checkboxes from a form via flowscript
Cocoon 2.1.8
I'm using flowscript to create a form, that consists of variable
number
of checkboxes:
var theForm = new Form("cocoon:/myform-create.xml");
theForm.showForm("rep/myform-display");
var nmodel = theForm.getModel();
var theValues = Array();
Now I need to process all the checkboxes and do the following:
* test if the ID matches a certain pattern AND checkbox is checked
* extract the value of the checkbox name
* store the result in the "theValues" array
I'd appreciate any pointers to sample code on how to do this.
Thanks
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: Processing checkboxes from a form via flowscript
Posted by Baptiste Placé <bo...@free.fr>.
Derek,
Please have a look at the API (1), you may find methods to iterate over
a set of childrend of a given form.
I never used this, but you should find what you need by digging a little
into it :)
Baptiste
(1)
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Form.html
Derek Hohls a écrit :
> Baptiste
>
> How would this work for a multi-select situation ie.
> you have a set of checkboxes, each with the same
> name - this will result in an array of values being
> returned that need to be processed (presumably in
> an Array() ?)
>
> Derek
>
>
> >>> Baptiste Placé <bo...@free.fr> 2007/06/07 05:23 PM >>>
> Derek,
>
> form.getChild("textbox").getValue(); will return a String, checkboxes
> return boolean values.
> I process these in java with explicit casting.
> In JS you could do something like :
>
> var bool;
> bool = formData.get("checkbox");
>
>
> Nothing tricky here :)
> -Baptiste
>
>
> Derek Hohls a écrit :
> > Baptiste
> >
> > Thanks for this helpful info. Do you have a snippet of Javascript code
> > whereby you process the values returned from the form; something
> > like:
> > form.getChild("textbox").getValue();
> >
> > Thanks
> > Derek
> >
> >
> >
> >>>> Baptiste Placé <bo...@free.fr> 2007/05/31 02:06:53 PM >>>
> >>>>
> >
> > Hi Derek,
> >
> > In my flowscript, I use following code to store form values in a
> HashMap :
> >
> > function fill_formData(){
> > formData = new java.util.HashMap();
> > formData.put("typeNode",
> form.getChild("SO_ST_selection").getValue());
> > formData.put("tyappli", form.getChild("procedure_type").getValue());
> > formData.put("level1", form.getChild("Level1").getValue());
> > formData.put("level2", form.getChild("Level2").getValue() );
> > formData.put("textbox", form.getChild("textbox").getValue());
> > }
> >
> > My form consist of two selection lists, two checkboxes (level 1 and 2)
> > and a textbox. I test the value in Java but you may do it in flowscript
> > (although I would not do that :) )
> > My checkboxes are boolean fields, it contains standard true/false
> values.
> >
> > You may use the API for more information :
> >
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/flow/java/FormInstance.html
>
> > and
> >
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Widget.html
>
> > Widget methods like getId and getFullName exist.
> >
> > Hope this will help.
> >
> > -Baptiste
> >
> > Derek Hohls a écrit :
> >
> >> Cocoon 2.1.8
> >>
> >> I'm using flowscript to create a form, that consists of variable
> >> number
> >> of checkboxes:
> >>
> >> var theForm = new Form("cocoon:/myform-create.xml");
> >> theForm.showForm("rep/myform-display");
> >> var nmodel = theForm.getModel();
> >> var theValues = Array();
> >>
> >> Now I need to process all the checkboxes and do the following:
> >> * test if the ID matches a certain pattern AND checkbox is checked
> >> * extract the value of the checkbox name
> >> * store the result in the "theValues" array
> >>
> >> I'd appreciate any pointers to sample code on how to do this.
> >>
> >> Thanks
> >> Derek
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
>
>
> --
> 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 CSIR
> CallCentre <ma...@csir.co.za>
>
>
> This message has been scanned for viruses and dangerous content by
> *MailScanner* <http://www.mailscanner.info/>,
> 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: Processing checkboxes from a form via flowscript
Posted by Derek Hohls <DH...@csir.co.za>.
Baptiste
How would this work for a multi-select situation ie.
you have a set of checkboxes, each with the same
name - this will result in an array of values being
returned that need to be processed (presumably in
an Array() ?)
Derek
>>> Baptiste Placé <bo...@free.fr> 2007/06/07 05:23 PM >>>
Derek,
form.getChild("textbox").getValue(); will return a String, checkboxes return boolean values.
I process these in java with explicit casting.
In JS you could do something like :
var bool;
bool = formData.get("checkbox");
Nothing tricky here :)
-Baptiste
Derek Hohls a écrit :
> Baptiste
>
> Thanks for this helpful info. Do you have a snippet of Javascript code
> whereby you process the values returned from the form; something
> like:
> form.getChild("textbox").getValue();
>
> Thanks
> Derek
>
>
>
>>>> Baptiste Placé <bo...@free.fr> 2007/05/31 02:06:53 PM >>>
>>>>
>
> Hi Derek,
>
> In my flowscript, I use following code to store form values in a HashMap :
>
> function fill_formData(){
> formData = new java.util.HashMap();
> formData.put("typeNode", form.getChild("SO_ST_selection").getValue());
> formData.put("tyappli", form.getChild("procedure_type").getValue());
> formData.put("level1", form.getChild("Level1").getValue());
> formData.put("level2", form.getChild("Level2").getValue() );
> formData.put("textbox", form.getChild("textbox").getValue());
> }
>
> My form consist of two selection lists, two checkboxes (level 1 and 2)
> and a textbox. I test the value in Java but you may do it in flowscript
> (although I would not do that :) )
> My checkboxes are boolean fields, it contains standard true/false values.
>
> You may use the API for more information :
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/flow/java/FormInstance.html
> and
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Widget.html
> Widget methods like getId and getFullName exist.
>
> Hope this will help.
>
> -Baptiste
>
> Derek Hohls a écrit :
>
>> Cocoon 2.1.8
>>
>> I'm using flowscript to create a form, that consists of variable
>> number
>> of checkboxes:
>>
>> var theForm = new Form("cocoon:/myform-create.xml");
>> theForm.showForm("rep/myform-display");
>> var nmodel = theForm.getModel();
>> var theValues = Array();
>>
>> Now I need to process all the checkboxes and do the following:
>> * test if the ID matches a certain pattern AND checkbox is checked
>> * extract the value of the checkbox name
>> * store the result in the "theValues" array
>>
>> I'd appreciate any pointers to sample code on how to do this.
>>
>> Thanks
>> Derek
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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
--
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.
Re: Processing checkboxes from a form via flowscript
Posted by Baptiste Placé <bo...@free.fr>.
Derek,
form.getChild("textbox").getValue(); will return a String, checkboxes return boolean values.
I process these in java with explicit casting.
In JS you could do something like :
var bool;
bool = formData.get("checkbox");
Nothing tricky here :)
-Baptiste
Derek Hohls a écrit :
> Baptiste
>
> Thanks for this helpful info. Do you have a snippet of Javascript code
> whereby you process the values returned from the form; something
> like:
> form.getChild("textbox").getValue();
>
> Thanks
> Derek
>
>
>
>>>> Baptiste Placé <bo...@free.fr> 2007/05/31 02:06:53 PM >>>
>>>>
>
> Hi Derek,
>
> In my flowscript, I use following code to store form values in a HashMap :
>
> function fill_formData(){
> formData = new java.util.HashMap();
> formData.put("typeNode", form.getChild("SO_ST_selection").getValue());
> formData.put("tyappli", form.getChild("procedure_type").getValue());
> formData.put("level1", form.getChild("Level1").getValue());
> formData.put("level2", form.getChild("Level2").getValue() );
> formData.put("textbox", form.getChild("textbox").getValue());
> }
>
> My form consist of two selection lists, two checkboxes (level 1 and 2)
> and a textbox. I test the value in Java but you may do it in flowscript
> (although I would not do that :) )
> My checkboxes are boolean fields, it contains standard true/false values.
>
> You may use the API for more information :
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/flow/java/FormInstance.html
> and
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Widget.html
> Widget methods like getId and getFullName exist.
>
> Hope this will help.
>
> -Baptiste
>
> Derek Hohls a écrit :
>
>> Cocoon 2.1.8
>>
>> I'm using flowscript to create a form, that consists of variable
>> number
>> of checkboxes:
>>
>> var theForm = new Form("cocoon:/myform-create.xml");
>> theForm.showForm("rep/myform-display");
>> var nmodel = theForm.getModel();
>> var theValues = Array();
>>
>> Now I need to process all the checkboxes and do the following:
>> * test if the ID matches a certain pattern AND checkbox is checked
>> * extract the value of the checkbox name
>> * store the result in the "theValues" array
>>
>> I'd appreciate any pointers to sample code on how to do this.
>>
>> Thanks
>> Derek
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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
Re: Processing checkboxes from a form via flowscript
Posted by Derek Hohls <DH...@csir.co.za>.
Baptiste
Thanks for this helpful info. Do you have a snippet of Javascript code
whereby you process the values returned from the form; something
like:
form.getChild("textbox").getValue();
Thanks
Derek
>>> Baptiste Placé <bo...@free.fr> 2007/05/31 02:06:53 PM >>>
Hi Derek,
In my flowscript, I use following code to store form values in a HashMap :
function fill_formData(){
formData = new java.util.HashMap();
formData.put("typeNode", form.getChild("SO_ST_selection").getValue());
formData.put("tyappli", form.getChild("procedure_type").getValue());
formData.put("level1", form.getChild("Level1").getValue());
formData.put("level2", form.getChild("Level2").getValue() );
formData.put("textbox", form.getChild("textbox").getValue());
}
My form consist of two selection lists, two checkboxes (level 1 and 2)
and a textbox. I test the value in Java but you may do it in flowscript
(although I would not do that :) )
My checkboxes are boolean fields, it contains standard true/false values.
You may use the API for more information :
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/flow/java/FormInstance.html
and
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Widget.html
Widget methods like getId and getFullName exist.
Hope this will help.
-Baptiste
Derek Hohls a écrit :
> Cocoon 2.1.8
>
> I'm using flowscript to create a form, that consists of variable
> number
> of checkboxes:
>
> var theForm = new Form("cocoon:/myform-create.xml");
> theForm.showForm("rep/myform-display");
> var nmodel = theForm.getModel();
> var theValues = Array();
>
> Now I need to process all the checkboxes and do the following:
> * test if the ID matches a certain pattern AND checkbox is checked
> * extract the value of the checkbox name
> * store the result in the "theValues" array
>
> I'd appreciate any pointers to sample code on how to do this.
>
> Thanks
> 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: Processing checkboxes from a form via flowscript
Posted by Baptiste Placé <bo...@free.fr>.
Hi Derek,
In my flowscript, I use following code to store form values in a HashMap :
function fill_formData(){
formData = new java.util.HashMap();
formData.put("typeNode", form.getChild("SO_ST_selection").getValue());
formData.put("tyappli", form.getChild("procedure_type").getValue());
formData.put("level1", form.getChild("Level1").getValue());
formData.put("level2", form.getChild("Level2").getValue() );
formData.put("textbox", form.getChild("textbox").getValue());
}
My form consist of two selection lists, two checkboxes (level 1 and 2)
and a textbox. I test the value in Java but you may do it in flowscript
(although I would not do that :) )
My checkboxes are boolean fields, it contains standard true/false values.
You may use the API for more information :
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/flow/java/FormInstance.html
and
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Widget.html
Widget methods like getId and getFullName exist.
Hope this will help.
-Baptiste
Derek Hohls a écrit :
> Cocoon 2.1.8
>
> I'm using flowscript to create a form, that consists of variable
> number
> of checkboxes:
>
> var theForm = new Form("cocoon:/myform-create.xml");
> theForm.showForm("rep/myform-display");
> var nmodel = theForm.getModel();
> var theValues = Array();
>
> Now I need to process all the checkboxes and do the following:
> * test if the ID matches a certain pattern AND checkbox is checked
> * extract the value of the checkbox name
> * store the result in the "theValues" array
>
> I'd appreciate any pointers to sample code on how to do this.
>
> Thanks
> Derek
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Processing checkboxes from a form via flowscript
Posted by johnson <jo...@erp.tw>.
Please see the issue I post in
http://issues.apache.org/jira/browse/COCOON-1900
it's fix in 2.1.10, If you use early version, please fix it by
yourself.(by fixing the form-field-styling.xsl).
Best Regards
johnson hsu
Derek Hohls ??:
> Cocoon 2.1.8
>
> I'm using flowscript to create a form, that consists of variable
> number
> of checkboxes:
>
> var theForm = new Form("cocoon:/myform-create.xml");
> theForm.showForm("rep/myform-display");
> var nmodel = theForm.getModel();
> var theValues = Array();
>
> Now I need to process all the checkboxes and do the following:
> * test if the ID matches a certain pattern AND checkbox is checked
> * extract the value of the checkbox name
> * store the result in the "theValues" array
>
> I'd appreciate any pointers to sample code on how to do this.
>
> Thanks
> Derek
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org