[symfony-users] Re: Form validation

2011-02-16 Thread Lideln


On 16 fév, 00:02, Christophe COEVOET s...@notk.org wrote:
 Le 15/02/2011 23:57, Lideln a crit :

  Since I cannot add new answers to the topic I created earlier (why
  that ?), I create a new one here with additionnal info.

  As I said, I followed the official tutorial to create a RegisterForm
  and using it to register new members.
  But I got stuck at the validation, because I got the error :
  The option validator is required for validating

  Here is my code, please can you tell me what I did wrong ?

  [config.yml]
  app.config:
       error_handler: null
       validation:    { enabled: true, annotations: true }

  [controller]
             $oRequest = new RegisterRequest();
             $oForm = RegisterForm::create($this-get('form.context'));

 You need to provide the name of the form here as a second argument. The
 doc of the master has been fixed for this point.

 Regards

 --
 Christophe | Stof

Hi Christophe,

Thanks for the answer !
Yes I have been told that (although my method seems to work as well).
Do you have any tips regarding the error I got ?

(I'm sorry I created another topic, if an admin car move it please ?)

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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


[symfony-users] Re: Form Validation

2009-12-03 Thread WEB-CHALLENGE
Thanks a lot!

I've just found the solution before your post!

Thanks anyway for your contribution and help. :*

On 2 déc, 21:14, Alexandre Salomé alexandre.sal...@gmail.com wrote:
 Hi,

   Welcome to symfony :)

   You must set a postValidator on the validatorSchema of your form.

   In the configure() method of your form :

 public function configure()
 {
   $this-setPostValidator(new sfValidatorSchemaCompare(left_field,
 sfValidatorSchemaCompare::GREATER_THAN, right_field));

 }

 Is it OK ?

 Alexandre

 2009/12/2 WEB-CHALLENGE kottiano...@gmail.com



  Hi everybody!

  I'm a new Symfony User.

  I want to setup a form where the user can enter many values.

  But, in the validation, the form won't be valid unless a certain data
  [an integer field] is greater than an other also entered by the user.

  I think it's simple but I'm really novice in Symfony environnement.

  Thanks

  --

  You received this message because you are subscribed to the Google Groups
  symfony users group.
  To post to this group, send email to symfony-us...@googlegroups.com.
  To unsubscribe from this group, send email to
  symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en.

 --
 Alexandre Salomé -- alexandre.sal...@gmail.com

--

You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-us...@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.




[symfony-users] Re: Form validation

2009-08-15 Thread Stefano Sancese

Ciao Richtermeister,

I wrote the validator as a Callback:

?php

/**
 * Listino form.
 *
 * @packageSuperAdmin
 * @subpackage form
 * @author Your name here
 * @versionSVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21
07:10:32Z dwhittle $
 */
class ListinoForm extends BaseListinoForm
{
  public function configure()
  {
   $this-widgetSchema['DataInizioValidita'] = new sfWidgetFormI18nDate
(array('culture' = 'it_IT', 'month_format' = 'short_name'));
   $this-validatorSchema-setPostValidator(new sfValidatorCallback
(array('callback' = array($this, 'checkSoglie';
  }

 public function checkSoglie($validator, $values)
 {

  $trovataSoglia = false;

snip

   if ($values['Importo'.$i] = $values['Importo'.($i - 1)])
  {
   throw new sfValidatorError($validator, Ogni importo deve
essere inferiore al precedente. (Importo$i));
   return $values;
  }
  }
  return $values;
 }

}

and I put it in lib/form/modelForm.class.php.

It's form and problem specific, so I'm not going to reuse the logic
anywhere in the project.

I wonder if this is the right place where to put the code!?

Now I'm looking for a way to highlight the wrong fields (with a red
border, like the standard validators do) to the user...

Stefano



On 12 Ago, 20:34, Richtermeister nex...@gmail.com wrote:
 Hey Stefano,

 I would write a custom post-validator. A post validator is given the
 entire data array, so from there you can just loop over the array and
 see if the values keep increasing..

 Hope this helps,
 Daniel

 On Aug 12, 8:57 am, Stefano stef...@sancese.com wrote:

  Hi,

  I'm developing my first web-application and I'm still RTFM (Reading
  The Fabulous Manuals), but I need a little help with a form
  validation.

  For this application I'm using the Admin Generator.

  The form contains 5 target fields: T1, T2, T3, T4, T5; every target
  must be greater than the previous: T1  T2  T3  T4  T5.

  But only T1 is required while the other targets can be empty.

  If a target is empty all the next ones must be empty.

  So:
            T1= 100, T2= 200, T3=empty, T4=empty, T5=empty is valid,
  but:
            T1=100, T2=empty, T3=200, T4=empty, T5=empty is NOT valid.

  I'm putting some code in lib/form/modelForm.class.php:

  class ListinoForm extends BaseListinoForm
  {
    public function configure()
    {
     $this-validatorSchema-setPostValidator(new sfValidatorAnd(array
  (new sfValidatorSchemaCompare('T1',
  sfValidatorSchemaCompare::LESS_THAN, 'T2';
    }

  }

  but I don't know how to test if a field is empty and I'm afraid that
  the resulting instruction will be very hard to read.

  Any hint?

  TIA

  Stefano


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation

2009-08-12 Thread Richtermeister

Hey Stefano,

I would write a custom post-validator. A post validator is given the
entire data array, so from there you can just loop over the array and
see if the values keep increasing..

Hope this helps,
Daniel



On Aug 12, 8:57 am, Stefano stef...@sancese.com wrote:
 Hi,

 I'm developing my first web-application and I'm still RTFM (Reading
 The Fabulous Manuals), but I need a little help with a form
 validation.

 For this application I'm using the Admin Generator.

 The form contains 5 target fields: T1, T2, T3, T4, T5; every target
 must be greater than the previous: T1  T2  T3  T4  T5.

 But only T1 is required while the other targets can be empty.

 If a target is empty all the next ones must be empty.

 So:
           T1= 100, T2= 200, T3=empty, T4=empty, T5=empty is valid,
 but:
           T1=100, T2=empty, T3=200, T4=empty, T5=empty is NOT valid.

 I'm putting some code in lib/form/modelForm.class.php:

 class ListinoForm extends BaseListinoForm
 {
   public function configure()
   {
    $this-validatorSchema-setPostValidator(new sfValidatorAnd(array
 (new sfValidatorSchemaCompare('T1',
 sfValidatorSchemaCompare::LESS_THAN, 'T2';
   }

 }

 but I don't know how to test if a field is empty and I'm afraid that
 the resulting instruction will be very hard to read.

 Any hint?

 TIA

 Stefano
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form Validation based on a tainted value?

2009-07-26 Thread Gábor Fási

I'm not sure I get what you mean. If you want to make sure one date is
later than another one, I suggest you set up an
sfValidatorSchemaCompare [1] instance as a post validator.

[1] 
http://www.symfony-project.org/forms/1_2/en/B-Validators#chapter_b_sub_sfvalidatorschemacompare

On Sun, Jul 26, 2009 at 21:35, johnwardsjohnwa...@gmail.com wrote:

 Hello,

 I have a form containing dates, I have two fields called:

 Auction date
 Baseline required by

 Auction date must be after the baseline date, now I can do this on
 existing objects by using the date validator and the min field.
 However, I need the tainted value for edits and new data. The tainted
 values are not avaliable until after bind.

 Now I could overload the bind method and then call my setup of
 validators after then but this seems wrong, especially since bind uses
 the validators...so I'd have to call them twice??

 I'm sure I am missing something here...help.

 Cheers
 John
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation in symfony1.2

2009-04-01 Thread Prashanth


Hi jmaicher,

Thanks For you Reply.
iam searching for form validations without using of widgets.

If you have any Idea Please Help me.

Regards,
Prashanth


On Mar 31, 6:53 pm, jmaicher julian.maic...@googlemail.com wrote:
 It's pretty simple .. you created a class which extends sfForm?!
 If so you just have to implement the configure()-function where you
 can create widgets (I hope you did that so far).
 With $this-setValidators you can specify validators for each widget
 or you can add a post validator.

 little example
 [code]
 class emailForm extends sfForm
 {
         public function configure()
         {
                 $this-setWidgets(array(
                         email = new sfWidgetFormInput(),
                 ));

                 $this-widgetSchema-setLabels(array(
                         email       = E-Mail,
                 ));

                 $this-setValidators(array(
                         email       = new sfValidatorEmail(array(), 
 array(invalid =
 Invalid email))
                 ));
         }}

 [/code]

 On 31 Mrz., 12:51, Prashanth pmahank...@gmail.com wrote:

  Thank you Very much For your Reply.
  And iam in little confusion where i have to write that code.
  Please Can you give the Example.

  On Mar 23, 8:26 pm, Fási Gábor maerl...@gmail.com wrote:

   You can use the validators described in the Forms book, appendix 
   Bhttp://www.symfony-project.org/book/forms/1_2/en/B-Validators
   they can be used w/o the form framework.

   On Mon, Mar 23, 2009 at 07:10, Prashanth pmahank...@gmail.com wrote:

Hi All,

iam working with symfony 1.2.
i have created the forms without using the widgets.
So please can any one help me How Can i validate the Form in
Symfony1.2.
Thanks 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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation in symfony1.2

2009-03-31 Thread Prashanth

Thank you Very much For your Reply.
And iam in little confusion where i have to write that code.
Please Can you give the Example.


On Mar 23, 8:26 pm, Fási Gábor maerl...@gmail.com wrote:
 You can use the validators described in the Forms book, appendix 
 Bhttp://www.symfony-project.org/book/forms/1_2/en/B-Validators
 they can be used w/o the form framework.

 On Mon, Mar 23, 2009 at 07:10, Prashanth pmahank...@gmail.com wrote:

  Hi All,

  iam working with symfony 1.2.
  i have created the forms without using the widgets.
  So please can any one help me How Can i validate the Form in
  Symfony1.2.
  Thanks 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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation in symfony1.2

2009-03-31 Thread jmaicher

It's pretty simple .. you created a class which extends sfForm?!
If so you just have to implement the configure()-function where you
can create widgets (I hope you did that so far).
With $this-setValidators you can specify validators for each widget
or you can add a post validator.

little example
[code]
class emailForm extends sfForm
{
public function configure()
{
$this-setWidgets(array(
email = new sfWidgetFormInput(),
));

$this-widgetSchema-setLabels(array(
email = E-Mail,
));

$this-setValidators(array(
email = new sfValidatorEmail(array(), 
array(invalid =
Invalid email))
));
}
}
[/code]

On 31 Mrz., 12:51, Prashanth pmahank...@gmail.com wrote:
 Thank you Very much For your Reply.
 And iam in little confusion where i have to write that code.
 Please Can you give the Example.

 On Mar 23, 8:26 pm, Fási Gábor maerl...@gmail.com wrote:

  You can use the validators described in the Forms book, appendix 
  Bhttp://www.symfony-project.org/book/forms/1_2/en/B-Validators
  they can be used w/o the form framework.

  On Mon, Mar 23, 2009 at 07:10, Prashanth pmahank...@gmail.com wrote:

   Hi All,

   iam working with symfony 1.2.
   i have created the forms without using the widgets.
   So please can any one help me How Can i validate the Form in
   Symfony1.2.
   Thanks 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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation in symfony1.2

2009-03-23 Thread Fási Gábor

You can use the validators described in the Forms book, appendix B
http://www.symfony-project.org/book/forms/1_2/en/B-Validators
they can be used w/o the form framework.

On Mon, Mar 23, 2009 at 07:10, Prashanth pmahank...@gmail.com wrote:

 Hi All,

 iam working with symfony 1.2.
 i have created the forms without using the widgets.
 So please can any one help me How Can i validate the Form in
 Symfony1.2.
 Thanks 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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation in symfony1.2

2009-03-23 Thread nidheesh


I think you should use widgets in sf1.2 to for validation. Its not
that much difficult to use it rather i think its easier than ordinary
form and validations used before.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation as array

2008-06-03 Thread Mauro Casula
Hi,

You have to create an edit.yml ( edit is your form submit action )
like this:

methods:
  post:
- feedback{name}
- feedback{email}
- feedback{message}


names:
  feedback{name}:
required: yes
required_msg: Insert a title.
.


Try this.. ;)
Regards.

Mauro Casula
symfony-framework.com



On Tue, Jun 3, 2008 at 8:39 AM, hudson [EMAIL PROTECTED] wrote:


 Hello!

 I hawe a form:

 [CODE]
 form method=POST
 input type=text name=feedback[name] value=1
 input type=text name=feedback[email] value=2
 input type=text name=feedback[message] value=3
 /form
 [/CODE]

 When I submit this form - I'll get on the server-side an array:

 [CODE]
 $feedback = array (
  name= 1,
  email   = 2,
  message = 3
 );
 [/CODE]

 How can I validate this form?
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: form validation -- model validation

2008-03-02 Thread Ian P. Christian

Thomas Rabaix wrote:
 The original propel project handle validation at the Model level. This
 feature has not been kept on symfony, don't know why ...

Firstly, please don't cross post! :)

Secondly, whilst I don't know why it was not done this way - but 
validating things in the model doesn't always make sense.

For example, it might be a requirement that usernames are 6 or more 
characters, but an admin creating a user should be allowd to bypass 
this.   Also when you're validating groups of models, that each might 
validate on their own, but as a group would be invalid...

Maybe the feature was not kept for these kind of reasons, I'm not sure.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Form validation problem

2007-09-19 Thread z01d

I am was having this and some other validation errors documented here:
http://www.symfony-project.com/forum/index.php/m/35804/#msg_35804

I'll try to see if the fix above works, thanks. Smells like a bug to
me.

On 19 сент, 13:35, nico_bl1nd [EMAIL PROTECTED] wrote:
 thanks Kiril,

 it works really well.

 I'll test more later why it doesn't want to take my post declarations
 at the beginning.

 Thanks again

 Nicolas Binet


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---