Thanks for the help lads.
Unfortunately im no closer to the solution in this case.
I think setting the default value should work.
But should this be considered a bug?
The values of the fields are set, but isSet() returns false.
See my 2 code snippets below.
============================ Method 1 ==================================
$params.init($data.Request)
#set( $jobId = $params.getInt("jobid", 0) )
#set( $schJobForm = $forms.getScheduledJobForm($jobId, $scheduler) )
#set( $schJobGroup = $intake.ScheduledJob.mapTo($schJobForm) )
#set( $fld = $schJobGroup.get("DisplayName") )
$fld.Key<br/>
$fld.Value<br/>
$fld.isSet()<br/>
======== Method 1 OUTPUT =========
ScheduledJob_0DisplayName
Fax Status Update
false
============================ Method 2 ==================================
$params.init($data.Request)
#set( $jobId = $params.getInt("jobid", 0) )
#set( $schJobForm = $forms.getScheduledJobForm($jobId, $scheduler) )
#set( $schJobGroup = $intake.get($schJobForm.IntakeGroupName,
$schJobForm.QueryKey) )
$schJobGroup.getProperties($schJobForm)
#set( $fld = $schJobGroup.get("DisplayName") )
$fld.Key<br/>
$fld.Value<br/>
$fld.isSet()<br/>
======== Method 2 OUTPUT =========
ScheduledJob_0DisplayName
Fax Status Update
false
-----Original Message-----
From: David Demner [mailto:[EMAIL PROTECTED]
Sent: Friday, October 20, 2006 10:22 PM
To: 'Turbine Users List'
Subject: RE: Intake service using businedd model beans
> What it all comes down to is that this method of pre populating the html
> form for
> editing data doesn't work 100% the way I need it, but what im really
> wondering is
> What is the "usual" pattern that other people use for "edit" forms.
I'm not sure what is 'usual' but I rely on Intake's defaultValue as Thomas
said:
...
<group name="Account" key="account" mapToObject="om.Account">
<field name="AccountType" key="AccountType" type="String"
defaultValue="Employee" displayName="Account Type *">
<rule name="maxLength" value="50">The account type must be less than 50
characters long</rule>
</field>
</group>
...
Screen velocity template:
#if ($accountId == "-1")
#set ($intakeGroup = $intake.Account.Default)
$intakeGroup.EmployerCode.setDefaultValue($employer.EmployerCode)
#else
#set ($accountObj = $employer.getAccountByPk($accountId))
#set ($intakeGroup = $intake.Account.mapTo($accountObj))
#end
## use $intakeGroup to populate controls
Action (paraphrased):
IntakeTool intake = (IntakeTool) context.get("intake");
if (intake != null && intake.isAllValid()) {
Account a = new Account();
Group g = intake.get("account", IntakeTool.DEFAULT_KEY)
g.setProperties(a);
a.setNew(true OR false);
a.save();
}
Hope that helps,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]