/ Chcem odstrániť požiadavku a validáciu formulára zo ZendFrameWork 2 - php, formulárov, validácie, zend-framework2

Chcem odstrániť požiadavku a validáciu formulára zo ZendFrameWork 2 - php, formulárov, validácie, zend-framework2

Ako odstrániť požadované potvrdenie poľa a formulára z nasledujúceho kódu.

<?php
namespace ApplicationForm;

use ZendFormForm;

/**
* Class DomainForm
* @package ApplicationForm
*/
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" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "url",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "id_provider",
"type" => "ZendFormElementSelect",
"attributes" => array(
"class" => "form-control"
),
"options" => array(
"empty_option" => "-",
"value_options" => $options["provider"]
)
));

$this->add(array(
"name" => "id_hosting",
"type" => "ZendFormElementSelect",
"attributes" => array(
"class" => "form-control"
),
"options" => array(
"empty_option" => "-",
"value_options" => $options["hosting"]
)
));

$this->add(array(
"name" => "id_server",
"type" => "ZendFormElementSelect",
"attributes" => array(
"class" => "form-control",
),
"options" => array(
"empty_option" => "-",
"value_options" => $options["server"]
)
));

$this->add(array(
"name" => "host_ftp",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "user_ftp",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "pwd_ftp",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "port_ftp",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "type_ftp",
"type" => "ZendFormElementSelect",
"attributes" => array(
"class" => "form-control"
),
"options" => array(
"empty_option" => "-",
"value_options" => $options["type_ftp"]
)
));

$this->add(array(
"name" => "auth_code",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "expired",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control input-datepicker"
)
));

$this->add(array(
"name" => "info",
"type" => "ZendFormElementTextarea",
"attributes" => array(
"class" => "form-control"
)
));

$this->add(array(
"name" => "id_customers",
"type" => "ZendFormElementSelect",
"attributes" => array(
"class" => "form-control"
),
"options" => array(
"empty_option" => "-",
"value_options" => $options["customers"]
)
));

$this->add(array(
"name" => "price",
"type" => "ZendFormElementText",
"attributes" => array(
"class" => "form-control",
"placeholder" => "9999,99"
)
));

//...
}
}

odpovede:

0 pre odpoveď č. 1

Z regulátora môžete zmeniť filter, aby ste povolili prázdne hodnoty pre toto pole:

$form->getInputFilter()->get("YOUR_FIELD")->setAllowEmpty(true);

V každom prípade vaša otázka nie je jasná