The AgaviFromPopulationFilter is handy to re-fill a form after validation failed and the user needs to check the values again (without refilling them by hand again).
But the FormPopulationFilter (FPF) is also capable of pre-filling forms.
Just get into your view and add the following:
if ([strong]'read'[/strong] == $this->getContext()->getRequest()->getMethod()) {
$this->getContext()->getRequest()->setAttribute('[strong]populate[/strong]',
new AgaviParameterHolder(
array(
'name' => 'Test Entry',
[strong]'description'[/strong] => 'This is a short description'
)
), 'org.agavi.filter.FormPopulationFilter'
);
}
and your Formfields 'name' and 'description' will be prefilled.
I added the check for 'read' method, since you don't want to auto populate in the case you submitted the data.
The template looks tidy now:
<input type="text" name="name" />
<textarea name="[strong]description[/strong]"></textarea>
Thanks to