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/<model>Form.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
-~----------~----~----~----~------~----~------~--~---

Reply via email to