ShoGun, you are wrong, sfForm MUST be used anywhere as they provide
great features.
Thomas, when you embed a form the main form transform the embeded form
into an associative array. The fields from the embeded form is
accessible by doing $form['myEmbedFormName']['myField']
class yourMainform
{
$this->embedForm('myEmbedFormName', new myEmbedeForm);
}
On Wed, Oct 15, 2008 at 12:57 AM, ShoGuN <[EMAIL PROTECTED]> wrote:
>
> I dont use forms in view templates. The forms (and embed forms) only
> are util for edit templates.
>
> Regards!
>
>>
>> class CriteriaForm extends sfForm
>> {
>> public function configure()
>> {
>> /*
>> * Defining filters
>> */
>> $fields = array();
>> $labels = array();
>> $validators = array();
>>
>> /*
>> * Static fields
>> */
>> $fields['criteria_type'] = new sfWidgetFormInput(array('type' =>
>> 'radio'));
>> $validators['criteria_type'] = new
>> sfValidatorChoice(array('choices' => array_keys($criteria)), array(
>> 'required' => 'You must choose a criteria.'
>> ));
>>
>> /*
>> * Embeddable forms
>> */
>> $this->embedForm('central', new CriteriaCentralForm());
>> $this->embedForm('store', new CriteriaStoreForm());
>>
>> /*
>> * Validators
>> */
>> $this->setValidators($validators);
>>
>> /*
>> * Other stuff
>> */
>> $this->setWidgets($fields);
>> $this->widgetSchema->setLabels($labels);
>> $this->widgetSchema->setNameFormat('criteria[%s]');
>> }
>> </pre>
>>
>> Do I have to implement my own way to retrieve embed form or am I
>> missing something ?
>> I would like to access an embed form from the template/view.
>>
>> Thanks a lot
>
> >
>
--
Thomas Rabaix
Internet Consultant
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---