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.1 » sfValidatorCallback arguments
sfValidatorCallback arguments [message #59918] Mon, 01 September 2008 15:51 Go to next message
andersonvom  is currently offline andersonvom
Messages: 58
Registered: September 2006
Member
Hi all,

I've been trying to port old forms from symfony 1.0 to 1.1 but I'm having a hard time with a simple login form and I cant seem to find an answer anywhere.

Here's the deal. I add a sfValidatorCallback (password field) to the login form calling myValodatorLogin::execute(). From within this method I want to be able to access the value of the username field.

The problem: I COULD use
$request->getParameter('username');
but if I change the name format of the form, then I would have to change the validator function as well. For example:
$this->widgetSchema->setNameFormat('login[%s]');
then I would have to update the validator funcion to:
$request->getParameter('login[username]');

I seems wrong to me. How can I use the arguments option to pass this information? AFAIK, I should be able to either pass the username as one of the arguments OR access the $form->getValue('username');

Any ideas?

[Updated on: Mon, 01 September 2008 15:53]

Re: sfValidatorCallback arguments [message #63000 is a reply to message #59918 ] Mon, 13 October 2008 16:56 Go to previous message
andersonvom  is currently offline andersonvom
Messages: 58
Registered: September 2006
Member
Just so it can be used as further reference, a way around I found was to pass the field name format as an argument like this:

$arguments = array( 'usernameField'=>str_replace( '%s', 'username', $this->widgetSchema->getNameFormat() ) );



If anybody has a better way of doing things, please share!
Previous Topic:Tutorial 1.1 problem with backend (error 404)
Next Topic:sfPropelPager with I18n
Goto Forum:
  

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