I'm a little confused about what you're actually trying to achieve but in your situation it's probably simplest to use a sfValidatorCallback. Which will allow you to run you own custom logic. http://www.symfony-project.org/forms/1_2/en/B-Validators#chapter_b_sub_sfvalidatorcallback
There you can check if the value has changed - and if so - to check against Doctrine if the new field is valid. On Fri, 2009-10-30 at 06:02 -0700, ravi wrote: > thanx for the reply david.. > > but that is not what i need.. i want to use the > "sfValidatorDoctrineUnique" validator for username field. and at the > same time i also want that one user can edit his/her user name.. so at > the time of edit the user.. when one submits without changing the > username it will throw the error for "Username already exist.".. which > means that the same recording is validating itself.. > > On Oct 30, 5:25 pm, David Ashwood <da...@inspiredthinking.co.uk> > wrote: > > In your form class you'll need something like: > > > > public function configure() { > > parent::configure(); > > > > // Common Validation > > if ($this->isNew) { > > // extra validation for new objects > > } else { > > // extra validation for existing objects > > } > > } > > > > On Fri, 2009-10-30 at 03:44 -0700, ravi wrote: > > > Hello everyone, > > > > > I am using sfValidatorDoctrineUnique to validate unique username and > > > i am going to implement to edit the "username". so at the time when > > > form comes to edit the user and if i will not change the username then > > > also it gives me the error for uniquenes.. if any one know how to skip > > > a single record for sfValidatorDoctrineUnique while editing the form. > > > for example.. > > > user:- ravi > > > pass:- ravi > > > > > and if am going to edit the user then without changing username if > > > press save button then it will validate the the value "ravi" with my > > > own value "ravi" and throws error.. so is there any way to compare the > > > newly updated record with all records except the "edited one.."... > > > > > thanx in advance.. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---