jamest wrote:
>
> I have a class extending Zend_Form which I have created a DisplayGroup for
> using:
>
> $this->addElements(array($nok_forename, $nok_surname, $nok_day,
> $nok_month, $nok_year, $nok_address1, $nok_address2, $nok_town,
> $nok_county, $nok_postcode, $nok_country));
>
> $nok =
> $this->addDisplayGroup(array('nok_forename','nok_surname','nok_day','nok_month','nok_year','nok_address1','nok_address2','nok_town','nok_county','nok_postcode','nok_country'),'nextofkin');
>
> This displays perfectly, although I am unsure where to put setLegend() in.
>
> At first I thought $nok->setLegend(); but I can see that won't work. Do I
> have to add an array for options to $nok? If so, what is the code for it?
> The reference manual doesn't seem to cover setLegend() being applied in
> this way unless I have missed something.
>
After a lot of trial and error I managed to add the legend by passing it in
an array after the name was set in addDisplayGroup().
Final working code looks like this:
$nok =
$this->addDisplayGroup(array('nok_forename','nok_surname','nok_day','nok_month','nok_year','nok_address1','nok_address2','nok_town','nok_county','nok_postcode','nok_country'),'nextofkin',array('legend'=>'Next
of Kin');
--
View this message in context:
http://www.nabble.com/setLegend%28%29-with-Zend_Form-in-__construct-tp16850442p16850519.html
Sent from the Zend Framework mailing list archive at Nabble.com.