Ejemplo n.º 1
0
 public function getJavaScripts()
 {
     return array('/js/FRegistrationForm.js');
     $url_params = sfJqueryFormValidationRules::getUrlParams();
     $url_params['form'] = get_class($this);
     return array_merge(parent::getJavaScripts(), array(url_for($url_params)));
 }
  public function configure()
  {
      
    parent::configure();
        

   // VALIDATORS
    $this->setValidator('street' , new sfValidatorString(array('required' => true)));
    $this->setValidator('city'   , new sfValidatorString(array('required' => true)));
    $this->setValidator('zipcode', new sfValidatorString(array('min_length' => 4 )));
    $this->setValidator('phone'  , new sfValidatorString(array('min_length' => 10 )));
    
    $w = new sfWidgetFormChoice(array(
      'expanded' => true,
      'multiple' => false,
      'choices'  => array('m' => 'Mann', 'w' => 'Frau')
    ));

    $this->setValidator('gender' , new sfValidatorString(array('required' => true)));
    $this->widgetSchema['gender'] = $w;
    
    // do some additional styling
    
    //$v = $this->widgetSchema['date_of_birth']->getValidator();
    $years = range(date('Y'), date('Y')-100);
    $this->widgetSchema['date_of_birth'] = new sfWidgetFormI18nDate(array(
                'culture' => 'de',
                'years'       => array_combine($years, $years),
                'can_be_empty' => true,
                'empty_values' => array('day' => 'Tag', 'month' => 'Monat', 'year' => 'Jahr')
             ));
    $this->widgetSchema->setLabel(
                'date_of_birth',
                'Geburtstag'
            );
        
    }
Ejemplo n.º 3
0
 public function configure()
 {
     parent::configure();
     $this->setValidator('tos_accepted', new sfValidatorBoolean(array('required' => true)));
     $this->widgetSchema->setLabel('tos_accepted', '<a href="http://spreadly.com/system/tos" target="_blank">AGB\'s gelesen & bestätigt</a>');
 }