SolVioletteTransferStep1Form.class.php 876 B

123456789101112131415161718192021222324
  1. <?php
  2. class SolVioletteTransferStep1Form extends sfForm {
  3. public function setup()
  4. {
  5. $this->setWidgets(array(
  6. 'id' => new sfWidgetFormInputHidden(),
  7. 'amount' => new sfWidgetFormInput()
  8. ));
  9. $max_amount = $this->getOption('current_solde');
  10. $this->setValidators(array(
  11. 'id' => new sfValidatorPass(),
  12. 'amount' => new sfValidatorNumber(array('min' => 0, 'max' => $max_amount, 'required' => TRUE), array('min' => "Le montant minimum est de 0 Sols", 'max' => sprintf('Le montant du virement doit être inférieur à %s sols', $max_amount), 'required' => 'Le montant est obligatoire')),
  13. ));
  14. $this->widgetSchema->setNameFormat('transfer[%s]');
  15. $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
  16. parent::setup();
  17. }
  18. }