Warner Onstine wrote:
>
> Hi all,
> Just wondering if there is a better way to do this:
>
> Currently I have one form and whether an id is passed or not it either
> reflects a record in the database or a brand new record. There are also two
> possible button presses doUpdate and doInsert - only one shows depending on
> the id value.
>
> What currently happens is that I grab the group from the intake tool via:
> get("Project", IntakeTool.DEFAULT_KEY, false) for the insert action, and
>
This looks fine.
> get("Project", queryKey, false) for the update action
>
> Now queryKey I have to pull manually from the data submitted from the form
> via
> String queryKey = data.getParameters().get("proj"); - where proj is the
> Intake value that is pre-defined on ViewProject.vm page.
>
> So, is there a better way to do this?
Since you are updating, I assume there is a torque object that is being
updated. In this case I would
in template
#set ($project = torque object)
#set ($group = $intake.Project.mapTo($project))
then in the action you can do
Project project = torque object
Group group = intake.get("Project", project.getQueryKey(), false);
... validate etc ...
group.setProperties(project);
project.save();
john mcnally
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]