I want to validate a form that updates my business object properties
with intake. I got the latest cvs of turbine-2 repository and built a
new distribution of the turbine jar. I can easily use intake to add
validate items I add to my databse, but I'm running in to a snag when
trying to modify them. I've defined by business object in the intake
validation file. I use the following code to update my item:
IntakeTool intake = (IntakeTool) context.get("intake");
ParameterParser pp = data.getParameters();
if ( intake.isAllValid() ) {
Job j = new Job();
j.setNew(false);
Group group = intake.get("Job", IntakeTool.DEFAULT_KEY);
group.setProperties(j);
JobPeer.doUpdate(j);
Error--> data.getParameters().add("jobid", j.getJobId().toString());
data.setMessage("Job updated.");
} else {
data.setMessage("There was an error updating the job.
Check below for further information.");
}
It runs OK, until I try and retrieve the JobId. I get a Null Pointer
exception. Is there something I'm doing wrong here? Or is this a bug?
Do I need to specify that this is not a new object to intake? I would
include my template, but there are lots of fields so its really long.
But here's a little summary with most fields gone:
#set ( $job = $basecamp.getJob() ) - This gets a job from a pull tool
#set ( $jobGroup = $intake.Job.mapTo($job) )
<input type=hidden name="$jobGroup.JobId.Key" value="$jobGroup.JobId.Value">
#if ( !$jobGroup.Title.isValid() )
$jobGroup.Title.Message<br>
#end
<input type=text name="$jobGroup.Title.Key"
value="$!jobGroup.Title.Value" size="50">
.
.
.
.
$intake.declareGroups()
Thanks,
Dan Diephouse
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]