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 » legacy support » symfony 1.2 » throw validator error schema on an embedded form
throw validator error schema on an embedded form [message #76730] Mon, 13 April 2009 11:14 Go to next message
biggie_mac  is currently offline biggie_mac
Messages: 88
Registered: January 2009
Member
I'm trying to post validate some fields and curiously enough, I have an error that I haven't managed to google(could it be nobody else had this problem?)

I have an embedded form that I call using:

$this->embedForm('power_user_1', new PowerUserForm());
.

i'm calling a sfValidatorCallback where based on some checkings , I throw an error using:

$error = new sfValidatorError($validator, 'a custom error');
throw new sfValidatorErrorSchema($validator, array('power_user_1' => $error));


when I submit the page, isntead of seeing the error, I get

Fatal error: Cannot use object of type sfValidatorError as array in /usr/src/php/symfony/symfony12/lib/widget/sfWidgetFormSchema .class.php on line 499


if instead of 'power_user_1' I specify a field(not an embedded form), error displays ok. But I think symfony has a problem because I'm trying to display an error on an embedded form? Does anybody see an obvious error that I'm missing?

maybe I have to specify the field name instead of the name of the embedded form. But how do I specify the field name?

for example if you have a field called user, the input will have the name name_format[user] so to throw a validator u call
array('user' => $error) but if you have an embedded form and the input will look like name_format[user][user_id] for example, how do you specify the field name in the array??

thanks
Re: throw validator error schema on an embedded form [message #83254 is a reply to message #76730 ] Wed, 05 August 2009 22:10 Go to previous messageGo to next message
tiois  is currently offline tiois
Messages: 2
Registered: August 2009
Junior Member
Did you found the answer to your question ?

I got the same problem...

Thanks !
Re: throw validator error schema on an embedded form [message #97669 is a reply to message #76730 ] Tue, 20 April 2010 12:15 Go to previous message
kaktoos  is currently offline kaktoos
Messages: 4
Registered: April 2010
Junior Member
$error = new sfValidatorError($validator, 'bla bla bla');
$errorSch = new sfValidatorErrorSchema($validator, array('field' => $error));
throw new sfValidatorErrorSchema($validator, array('power_user_1' => $errorSch));


Try this dude.
Previous Topic:Unwanted DELETE
Next Topic:Troubleshooting view loading extremely slowly.
Goto Forum:
  

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