> > > 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]