Current path: home/webdevt/cryptoimpot.fr/module/Application/src/Form/
?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/src
<?php
namespace Application\Form;
use Laminas\Form\Element\Button;
use Laminas\Form\Element\Number;
use Laminas\Form\Element\Select;
use Laminas\Form\Element\Text;
use Laminas\Form\Form;
class DeclarationCompteForm extends Form {
public function __construct($em) {
parent::__construct('declaration-compte-form');
$this->setAttribute('method', 'post');
$this->addElements($em);
$this->addInputFilter();
}
/**
* This method adds elements to form (input fields and submit button).
*/
protected function addElements($em) {
$element = new \Application\Form\Element\ExchangeSelect($em);
$this->add($element);
$this->add([
'type' => 'text',
'name' => 'nom',
'options' => [
'label' => 'Quel est votre nom de famille ?',
],
]);
$this->add([
'type' => 'text',
'name' => 'prenoms',
'options' => [
'label' => 'Quels sont vos prénoms ?',
],
]);
$this->add([
'type' => 'text',
'name' => 'dateNaissance',
'options' => [
'label' => 'Quelle est votre date de naissance ?',
],
]);
$this->add([
'type' => 'select',
'name' => 'departementNaissance',
'options' => [
'label' => 'Montant reçue',
],
]);
$this->add([
'type' => 'text',
'name' => 'adresse',
'options' => [
'label' => 'Quelle est votre adresse de résidence ?',
],
]);
$this->add([
'type' => 'text',
'name' => 'fees',
'options' => [
'label' => 'Montant Frais',
],
]);
$element = new \Laminas\Form\Element\Csrf('csrf');
$this->add($element);
// Submit
$submitElement = new Button('submit');
$submitElement
->setLabel('Enregistrer et passer à l\'étape suivante')
->setAttributes(array(
'type' => 'submit',
));
$this->add($submitElement, array(
'priority' => -100,
));
}
/**
* This method creates input filter (used for form filtering/validation).
*/
private function addInputFilter() {
// Create main input filter
$inputFilter = $this->getInputFilter();
// Add input for "email" field
$inputFilter->add([
'name' => 'tradedAmount',
'required' => true,
'filters' => [
['name' => 'StringTrim'],
],
'validators' => [
[
'name' => 'StringLength',
'options' => [
'min' => 1,
'max' => 128
],
],
],
]);
$inputFilter->add([
'name' => 'tradedCurrency',
'required' => true,
'filters' => [
['name' => 'StringTrim'],
],
'validators' => [
[
'name' => 'StringLength',
'options' => [
'min' => 1,
'max' => 128
],
],
],
]);
$inputFilter->add([
'name' => 'receivedAmount',
'required' => true,
'filters' => [
['name' => 'StringTrim'],
],
'validators' => [
[
'name' => 'StringLength',
'options' => [
'min' => 1,
'max' => 128
],
],
],
]);
$inputFilter->add([
'name' => 'receivedCurrency',
'required' => true,
'filters' => [
['name' => 'StringTrim'],
],
'validators' => [
[
'name' => 'StringLength',
'options' => [
'min' => 1,
'max' => 128
],
],
],
]);
$inputFilter->add([
'name' => 'fees',
'required' => true,
'filters' => [
['name' => 'StringTrim'],
],
'validators' => [
[
'name' => 'StringLength',
'options' => [
'min' => 1,
'max' => 128
],
],
],
]);
$inputFilter->add([
'name' => 'feesCurrency',
'required' => true,
'filters' => [
['name' => 'StringTrim'],
],
'validators' => [
[
'name' => 'StringLength',
'options' => [
'min' => 1,
'max' => 128
],
],
],
]);
}
}