cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baptiste Placé <bo...@free.fr>
Subject Re: Processing checkboxes from a form via flowscript
Date Thu, 31 May 2007 12:06:53 GMT
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


Mime
View raw message