lundi 2 mars 2015

I want to remove Required and Form Validation from ZendFrameWork 2

How to remove required field and form validation from following code. How to remove required field and form validation from following code. How to remove required field and form validation from following code.



use Zend\Form\Form;

/**
* Class DomainForm
* @package Application\Form
*/
class DomainForm extends Form
{
/**
* @param string $name
* @param array $options
*/
public function __construct($name = '', $options = array())
{
parent::__construct($name);
$this->setAttribute('method', 'post');
$this->setAttribute('class', 'bottom-margin');
$this->setAttribute('id', 'validateForm');

$this->add(array(
'name' => 'fullname',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'url',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'id_provider',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'class' => 'form-control'
),
'options' => array(
'empty_option' => '-',
'value_options' => $options['provider']
)
));

$this->add(array(
'name' => 'id_hosting',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'class' => 'form-control'
),
'options' => array(
'empty_option' => '-',
'value_options' => $options['hosting']
)
));

$this->add(array(
'name' => 'id_server',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'class' => 'form-control',
),
'options' => array(
'empty_option' => '-',
'value_options' => $options['server']
)
));

$this->add(array(
'name' => 'host_ftp',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'user_ftp',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'pwd_ftp',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'port_ftp',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'type_ftp',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'class' => 'form-control'
),
'options' => array(
'empty_option' => '-',
'value_options' => $options['type_ftp']
)
));

$this->add(array(
'name' => 'auth_code',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'expired',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control input-datepicker'
)
));

$this->add(array(
'name' => 'info',
'type' => 'Zend\Form\Element\Textarea',
'attributes' => array(
'class' => 'form-control'
)
));

$this->add(array(
'name' => 'id_customers',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'class' => 'form-control'
),
'options' => array(
'empty_option' => '-',
'value_options' => $options['customers']
)
));

$this->add(array(
'name' => 'price',
'type' => 'Zend\Form\Element\Text',
'attributes' => array(
'class' => 'form-control',
'placeholder' => '9999,99'
)
));

//...
}
}

Aucun commentaire:

Enregistrer un commentaire