symfony1 - Problem with Symfony form validation -


I am unable to see that I am doing the wrong with the following SIMPhone 1.4 form validation. Actually, I just want to take all four situations correctly into account (required, minimum-length, maximum-length, regular expression). It actually works, but fails to display my custom error message for the 'required' condition and instead says "required". Is there a way to show my error message?

  'UserName' = & gt; New sfValidator and (array (new sfValidatorString (array ('required' = & gt; true, 'min_length' => 4, 'max_length' => 20), array ('required' => Enter username. ',' Min_length '= & gt;' Your user name must have at least 4 characters. ',' Max_length '= & gt;' Your user name can not be longer than 20 characters. ' ), New sfValidatorRegex (array ('pattern' = & gt; '/ ^ [A-z0- 9] * $ / i'), array ('invalid' = & gt; Or numbers can be (0-9). ')),)),  

add an extra H, if I remove the Reggae validator and convert it to the normal single-line string vendor, then my custom error message shows !?

Any?

ago Thank you.

I've seen the same issue about two weeks before and found a solution - just Move your message to sfValidator and declaration:

  'username' = & gt; New sfValidatorAnd (array (new sfValidatorString (array ('required' = & gt; true, 'min_length' => 4, 'max_length' => 20), array ('min_length' = & gt; Username must be at least 4 characters. ',' Max_length '= & gt;' Your username can not be longer than 20 characters'), New Sifvillator rezx (array ('pattern' => ^ [A-z0-9] * $ / i '), array (' invalid '= & gt;' only letter (aj) or number (0-9) 'in your username).),), Array ( ), Array ('Required' = & gt; Please enter a username. ')),  

It helped me, I hope this will help you too.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -