<?php

class SolVioletteTransferStep1Form extends sfForm {
	public function setup()
	{
		$this->setWidgets(array(
		  'id'                                => new sfWidgetFormInputHidden(),
		  'amount' 						                => new sfWidgetFormInput()
		));

		$max_amount = $this->getOption('current_solde');

		$this->setValidators(array(
		  'id'                                => new sfValidatorPass(),
		  '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')),
		));

		$this->widgetSchema->setNameFormat('transfer[%s]');

		$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

		parent::setup();
	}
}