You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Scott Eade <se...@backstagetech.com.au> on 2001/06/28 15:58:18 UTC
Intake & initial values
I have a form that I validate with intake that I
would like to provide initial values for some
of the fields. I have tried setting the intake
field values thus:
#set ($group.Active.Value = true)
#set ($group.StartDate.Value = $today)
but this doesn't seem to work.
Is there some way of initialising intake field values?
Thanks,
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Intake & initial values - Repost
Posted by John McNally <jm...@collab.net>.
Intake takes initial values from the objects attached to the groups
through the method "mapTo". Setting initial values the way you are
attempting to would be a good thing to support. I will keep it in mind
or feel free to add the functionality.
john mcnally
Scott Eade wrote:
>
> I'm reposting this in hope of receiving a reply.
>
> Cheers,
>
> Scott
>
> From: "Scott Eade" <se...@backstagetech.com.au>
> > I have a form that I validate with intake that I
> > would like to provide initial values for some
> > of the fields. I have tried setting the intake
> > field values thus:
> >
> > #set ($group.Active.Value = true)
> > #set ($group.StartDate.Value = $today)
> >
> > but this doesn't seem to work.
> >
> > Is there some way of initialising intake field values?
> >
> > Thanks,
> >
> > Scott
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Intake & initial values - Repost
Posted by Scott Eade <se...@backstagetech.com.au>.
> > > I have a form that I validate with intake that I
> > > would like to provide initial values for some
> > > of the fields. I have tried setting the intake
> > > field values thus:
> > >
> > > #set ($group.Active.Value = true)
> > > #set ($group.StartDate.Value = $today)
> > >
> > > but this doesn't seem to work.
>
> Scott, I think the above is equivalent to this:
>
> #set( $group.get( "StartDate" ).getValue() = $today )
I agree, so of course this way will not work.
> So, you're trying to assign to the value of getValue() which might be a
> clone of the Field value, not the Field value itself.
>
> Anyway, I don't know how you might get around this problem because there
> isn't an available setValue method (setValue is provided, but is not
> accessible). So this must be the "wrong" approach (not that I know where
> you might find the "right" approach). Maybe you call init with a
> Retrievable or something. I really don't know. I only use Field values
> in Java classes. In Velocity templates I instead reference the object
> that contains the values to which the input form relates. So, if the
> form submits information about a "Thing", then my Velocity template
> would call Thing.StartDate, for example. Of source, Thing needs to be
> defined for the template. It would probably be a property of an existing
> pull object, or else the Java class for the template puts the Thing into
> the template Context when doBuildTemplate is called.
I too mostly reference the object that contains the values, but
in this case it is for a new instance of the underlying object and
I am thus using the Default intake group.
Apart from delving into the intake code (which unfortunately
I do not have time for right now) the only other solution that
comes to mind involves retrieving a reference to a new instance
of the underlying object and populating it with the default values
before mapping that to intake. I haven't tried this yet as it seems
like a bit of a hack. Intake also seems to use the primary key
as the key value so I am not sure how this will be handled.
Thanks again for your comments.
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Intake & initial values - Repost
Posted by Scott Eade <se...@backstagetech.com.au>.
I'm reposting this in hope of receiving a reply.
Cheers,
Scott
From: "Scott Eade" <se...@backstagetech.com.au>
> I have a form that I validate with intake that I
> would like to provide initial values for some
> of the fields. I have tried setting the intake
> field values thus:
>
> #set ($group.Active.Value = true)
> #set ($group.StartDate.Value = $today)
>
> but this doesn't seem to work.
>
> Is there some way of initialising intake field values?
>
> Thanks,
>
> Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org