Scott,

Thank you for the reply, I still have more questions though, its never
ending :) I read the intake service doc (several times) and still can't
nail down a few things. Perhaps yourself or someone else can help me out
here. In my ficticous example from below, I have a checkbox that allows
the user to select an item of inventory to check out. I only want the
"reason" validated (ie: required/min 3 chars/max 8 chars etc) if that
piece of inventory's checkbox is selected. Is there a way to do that
with intake? 

Also I am having difficulty understanding how to get my objects back in
the action. If I follow your example here, (slightly modified), this
form validates everytime, even when I add rules to the fields and don't
meet the rules conditions. I am having problems with the differences
between $intake.Group.mapTo($object) and $intake.Group.Default. 

Thanks again,

-cam.

PS: Does this validation methodology change in turbine 3? or does intake
live on?

On Mon, 2002-02-18 at 08:44, Weaver, Scott wrote:
> Cameron,
> 
> You can map an existing object into multiple IntakeGroups that map to the
> same object.  
> Intake use the QueryKey of that object plus the value of the key attribute
> in the matching field tag of it's group within intake.xml. 
> 
> I have posted a quickie example using what you sent.  However there is a
> more in-depth how-to at: 
> http://jakarta.apache.org/turbine/turbine-2/services/intake-service.html
> 
> 
> <form name="aform" action="your.turbine.action" action="post">
> 
> #foreach($item in $inventory)
> #* 
>  * Create a IntakeGroup for each Inventory
>  * object in the list.  Then map that
>  * object into a Group.  This will create
>  * a unique form field name based on the QueryKey of
>  * each inventory object which is retrieved
>  * by $ig.Id.Key.  It will also map
>  * the properties in $ig.Id.Value to the
>  * Id property in your object (getId() setId(id).
> *#
> #set($ig = $intake.Invetory.mapTo($item))
> <input type="checkbox" name="$ig.Id.Key" value="$ig.Id.Value"> $item.name
> <br>
> 
> Reason for request: <input type="text" name="$ig.Reason.Key"
> value="$ig.Reason.Value"><br>
> 
> #end
> 
> <input type="submit" name="eventSubmit_doSomething" value="Checkout">
> 
> </form>
> 
> Example intake.xml snippet for this form/object:
> <group key="inv" name="Inventory" mapToObject="com.yourcomp.Inventory">
>  <field key="id" name="Id" type="String" mapToProperty="Id"/>
>  <field key="id" name="Reason" type="String" mapToProperty="Reason"/>
> </group>
> 
> 
> hth,
> Scott
> 
> 
> > -----Original Message-----
> > From: Cameron Cole [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, February 17, 2002 1:55 PM
> > To: Turbine Users List
> > Subject: Intake, Torque/Peers and HTML forms
> > 
> > 
> > Hello all,
> > 
> > I have been playing with Turbine for the past few days and 
> > have a small
> > application working. Of course a few questions have arisen and I have
> > been unable to find the answers to these questions so I 
> > thought I would
> > post a quick note to the list.
> > 
> > 1. Intake can create the binding between an html form and a 
> > java object.
> > What, if possible, is the best practise to create bindings between
> > multiple objects in a list and multiple form elements? I can probably
> > explain what I mean better with an example. Consider a simple 
> > inventory
> > mgmt system with only one simple object an Inventory.class item. If
> > someone wishes to "check out" a piece of inventory, or 
> > several pieces of
> > inventory, they need to give a reason for each piece of inventory they
> > are checking out. The velocity template would look something like this
> > (condensed):
> > 
> > <table>
> > #foreach ($item in $inventory)
> >     <tr>
> >     <td><input type="checkbox" name="id" value="$item.id"></td>
> >     <td>$item.name</td>
> >     <td><input type="text" name="help here" value=""></td>
> >     </tr>
> > #end
> >     <tr>
> >     <td colspan="3">
> >     <input type="submit" name="eventSubmit_doSomething" 
> > value="Checkout">
> >     </td>
> >     </tr>
> > </table>
> > 
> > It is easy to create the association between the checkboxes 
> > and the true
> > java objects via their unique id and the properties of a 
> > checkbox/radio
> > button/drop down list. However, how can I create a unique binding
> > between each java object and the text box? I don't want to do 
> > something
> > like: <input type="text" name="reason:$item.id"> and then 
> > have to parse
> > it out in the action. It also ruins all the neat bindings you can do
> > with peers and the intake service.
> > 
> > Is there a document I have missed reading or misinterpreted while
> > reading? If so can someone please shed some light on this 
> > problem. Must
> > I do parsing in the action?
> > 
> > Thanks in advance for your help,
> > 
> > -cam.
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to