This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » General discussion » InvalidArgumentException Error "A field must be an instance of sfWidget."
InvalidArgumentException Error "A field must be an instance of sfWidget." [message #103484] Tue, 03 August 2010 14:43
sharmil  is currently offline sharmil
Messages: 6
Registered: August 2010
Location: Mumbai, India
Junior Member

I have spent the entire day trying to troubleshoot this error but can't resolve this error.

Here is the code for which I am getting the error.

  		$cities = Doctrine::getTable('City')->getCityListByCountry(Doctrine::getTable('City')->findOneById('314')->getCountryId());
			  'merchant'    => new sfWidgetFormInput(array('label' => 'Merchant Name'), array('size' => 60)),
			  'address1'   => new sfWidgetFormInput(array('label' => 'Street Addres'), array('size'=>60)),
			  'address2' => new sfWidgetFormInput(array('label' => 'Building'), array('size'=>60)),
			  'zipcode' => new sfWidgetFormInput(array('label' => 'Zip Code'), array('size' => '6')),
			  'city', new sfWidgetFormDoctrineChoice(array('label'=> 'City','model'=>'City','add_empty'=>'-Select City-','choices'=>$cities)),
			  'email' => new sfWidgetFormInput(array('label'=>'Email Address'), array('style'=>'float:left')),
			  'password' => new sfWidgetFormInputPassword(array('label'=>'Password')),
			  'captcha_code' => new sfWidgetFormInput(array('label'=>'Enter Code From Image'))

It seems to stem from the 'city' field. When I remove that field and instead use the following code, it works fine.

$this->setWidget('city', new sfWidgetFormDoctrineChoice(array('label'=> 'City','model'=>'City','add_empty'=>'-Select City-','choices'=>$cities)));

Very odd, and what worries me is that my understanding of symfony forms and widgets is flawed. Can someone please help?


PS - I am using Symfony 1.4

  • Attachment: error.jpg
    (Size: 75.55KB, Downloaded 56 time(s))

Previous Topic:Cache and Session state
Next Topic:[POLL] What do you use symfony for?
Goto Forum:

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software