@RAPHAEL,

i tried it as follows:

    $widgetSchema = $this->form->getWidgetSchema();
    $validatorSchema = $this->form->getValidatorSchema();

    unset($widgetSchema['foo']);
    unset($validatorSchema['foo']);

    $this->form->setWidgetSchema($widgetSchema);
    $this->form->setValidatorSchema($validatorSchema);
    $this->form->resetFormFields();

but no, it wont work :(

@Ryan:

it tried it both ways, using sfFormFieldSchema::offsetUnset throws a
"read only" exception, and unset($form['foo']) simply does nothing,
the widget and validator still exists in the schemas.

why is the sfFormFieldSchema is throwing an exception on unsetting
fields through ::offsetUnset. I think it cant be very complicated the
remove widgets and validators after instanciating? or am i missing
something fundamental?

But i think there must be a way to achieve this, if i am able to do
"unset($this['foo']);" why not "unset($form['foo']);" and why the form
frameworks prevents it through sfFormFieldSchema::offsetUnset?
Too many questions left :(

Greetz
Robert

On 20 Sep., 00:04, RAPHAEL <[email protected]> wrote:
> To remove widgets from outside of the form class, one way could be:
>   $widgets = $form->getWidgetFormSchema();
>   unset($widgets['myfield']);      // and all other fields
>   $validators = $form->getValidatorSchema();
>   unset($validators['myfield']);      // and all other fields
>   // maybe add, after having unset all the fields:
>   $form->resetFormFields();
>
> I think that this should work (to be verified). It is however only a
> workaround for doing it within the form class (or in a subclass of it,
> in the configure() method).
>
> The sfFormFieldSchema stuff (to which the ArrayAccess stuff in the
> form class is linked to) is a sfForms-internal thing that has is own
> rules by when its data does exists and/or is valid. The reference are
> still the widget and validator schemas.
>
> Hope that helps, RAPHAEL

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" 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-devs?hl=en

Reply via email to