Skip to content

Instantly share code, notes, and snippets.

@treffynnon
Created February 4, 2010 15:19
Show Gist options
  • Save treffynnon/294742 to your computer and use it in GitHub Desktop.
Save treffynnon/294742 to your computer and use it in GitHub Desktop.
Agavi: Form pre-population
<?php
// Like so
$this->getContext()->getRequest()->setAttribute('populate', new AgaviParameterHolder(array(
'question[0]' => 'Can you eat cheese?',
'answer[0]' => 'No'
)), 'org.agavi.filter.FormPopulationFilter');
// Or like so...
$populate =& $this->getContext()->getRequest()->getAttribute('populate', 'org.agavi.filter.FormPopulationFilter');
$populate = new AgaviParameterHolder(array(
'question[0]' => 'Can you eat cheese?',
'answer[0]' => 'No'
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment