Hi all. I have this form (rendering works):
function init() {
$this->_db = Zend_Registry::get('db');
$method = isset($this->_options['method']) ?
$this->_options['method'] : 'post';
$name = isset($this->_options['name']) ? $this->_options['name']
: 'newCompany';
$this->setAction($this->_options['action']);
$this->setMethod($method)
->setName($name)
->setEnctype('multipart/form-data')
;
$decorators = array(
array('ViewHelper'),
array('Errors',array('class' => 'form_error', 'escape' => 'false')),
array('Label', array('requiredSuffix' => ' * '), 'class' =>
'leftalign'),
array('Description', array('escape' => false, 'tag' => 'span',
'class' => 'description'))
);
$user = new User_ProfileForm(array('submitLabel' =>
'Crea','action' => null));
$uu = $this->addSubForm($user,'user');
$this->addElements(array($uu));
}
(Ok, subform in this moment is useless, but I need it for the future).
Now: this is my action when the form is valid:
$form = new Admin_ClientAddForm(array('action' => 'add-client'));
if (!$this->_request->isPost()) {
$this->view->form = $form;
return;
}
//Se sono qui è perchè ho dei dati del post.
$params = $this->_request->getPost();
if (!$form->isValid($params)) {
$form->populate($params);
$this->view->form = $form;
return;
}
var_dump($params);
<------------- THIS IS [1]
//Se sono qui i dati sono corretti.
$params = $form->getValues();
//$params = $params[''];
unset($params['conferm_password']);
unset($params['submit']);
var_dump($params);
<------------- THIS IS [2]
{OTHER INSTRUCTIONS}
}
And these are the var_dump's outputs:
*[1]
array*
'company_name' => string 'c1' /(length=2)/
'email' => string '[email protected]' /(length=18)/
'password' => string 'michel' /(length=6)/
'conferm_password' => string 'michel' /(length=6)/
'vat' => string '1234567890' /(length=10)/
'address' => string 'via grossich 29' /(length=15)/
'id_prov' => string 'AL' /(length=2)/
'id_city' => string '006001' /(length=6)/
'phone' => string '+39398909874' /(length=12)/
'fax' => string '1234567890' /(length=10)/
'submit' => string 'Crea' /(length=4)/
*
[2]
array*
'' =>
*array*
'company_name' => string 'c1' /(length=2)/
'email' => string '[email protected]' /(length=18)/
'password' => string 'michel' /(length=6)/
'conferm_password' => string 'michel' /(length=6)/
'vat' => string '1234567890' /(length=10)/
'address' => string 'via grossich 29' /(length=15)/
'id_prov' => string 'AL' /(length=2)/
'id_city' => string '006001' /(length=6)/
'phone' => string '+39398909874' /(length=12)/
'fax' => string '1234567890' /(length=10)/
'submit' => string 'Crea' /(length=4)/
Why [2] is an array of array where the only element is '' ?
Tnx.
--
Michel 'ZioBudda' Morelli [email protected]
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 -- Fax: +39-0291390660
http://www.ziobudda.net ICQ: 58351764
http://www.ziobuddalabs.it Skype: zio_budda
http://www.ajaxblog.it MSN: [email protected]
JABBER: [email protected]