<?php

class wwwSignupForm extends BaseSignupForm
{
    public function configure()
    {
        $this->useFields(array('username', 'password', 'name'));

        $this->widgetSchema['name'] = new sfWidgetFormInputText(array('label' => '&nbsp;'), array('size' => 24, 'placeholder' => 'Имя', 'required' => true, 'autocomplete' => 'off'));
        $this->widgetSchema['username'] = new sfWidgetFormInputText(array('label' => '&nbsp;'), array('size' => 24, 'placeholder' => 'Телефон', 'required' => true, 'autocomplete' => 'off', 'autofocus' => 'on', 'class' => 'phone'));
        $this->widgetSchema['password'] = new sfWidgetFormInputPassword(array('label' => '&nbsp;'), array('size' => 24, 'placeholder' => 'Пароль', 'required' => true, 'autocomplete' => 'off'));
    }

    public function doBind(array $values)
    {
        if(is_array($values) && isset($values['username']) && is_string($values['username'])){
            $values['username'] = Page::perfectPhone($values['username']);
        }
        parent::doBind($values);
    }

    public function isValid()
    {
        $is_valid = parent::isValid();
        if($is_valid){

        }
        return $is_valid;
    }
}
