Hey Robert- What's the exception that you're receiving? Using unset($form['field_name']) should work just fine - unsetting fields in sfForm is allowed. Unsetting fields in sfFormFieldSchema, however, is not allowed. So, is it possible that by the time you're unsetting those fields you're actually operating on a form field schema instance? I do believe you will run into problems if you want to unset fields of an embedded form after it's already embedded.
Ryan Weaver Lead Programmer Iostudio, LLC http://www.sympalphp.org http://www.thatsquality.com Twitter: @weaverryan On Sun, Sep 19, 2010 at 7:54 AM, Robert Schoenthal <[email protected]>wrote: > He Folks, > > i've ran into a strange problem. > > I am trying to remove a set of form fields from a allready > instanciated form. > here is a snippet: > > $formClass = 'fooForm'; > $fields = array('foo','bar'=>array('bazz','embed'=>'foo')); > > $form = new $formClass(); > > unset($form['foo']); //wont work, ::offsetUnset throws an exception > > what i am trying is to recursivly remove all the fields defined in > $fields. > the form still throws an error on "foo" and i expect a "unexpected > variable" error on this field. > > As i dont know which form i am instanciating, i cant extend the class, > and do it inside the form. > > why is sfForm::offsetUnset is throwing an Exception on this? > > I tried it with iterating over the sfFormfieldSchema, replacing the > whole sfWidgetFormSchema and sfValidatorSchema, but nothing worked as > expected. > > So whats the best way to remove form fields from instanciated forms? > > cheerz > Robert > > -- > 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]<symfony-devs%[email protected]> > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > -- 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
