Im currently creating a zend form status dropdown to let users to update their status.
All the status values are coming from the the database. Using the getProviderQuoteStatus($providerId,$quoteId,$quoteStatusId) method to determine what status is available to the user.
The problem I'm facing at the moment is when the form go through the validation process.
I'm keep getting '1' was not found in the haystack (because the status values is populated in the controller and not in the form itself therefore the providerQuoteStatus form element array is empty) . Can anyone help me out how can I solve this problem?
Thanks so much in advance!
private function getProviderQuoteStatusForm()
{
$form = new Application_Form_ProviderQuoteStatus(array(
'action' => '/leads/update-Provider-Quote-Status'
,'method' => 'post',
));
return $form;
}
private function getProviderQuoteStatus($providerId,$quoteId,$quoteStatusId)
{
$form = $this->getProviderQuoteStatusForm();
$providerQuoteStatus = new Application_Model_DbTable_ProviderQuoteStatus();
$providerQuoteStatusValues = $providerQuoteStatus->
getProviderQuoteStatusUpdateValues ($quoteStatusId);
$form->getElement('providerQuoteStatus')->addMultiOptions($providerQuoteStatusValues);
$form->getElement('providerQuoteStatus')->setValue($quoteStatusId);
$form->getElement('quoteId')->setValue($quoteId); // set Quote Id to the hidden field
return $form;
}
public function updateProviderQuoteStatusAction()
{
$form = $this->getProviderQuoteStatusForm(); // Status Update dropdown box
$this->view->form = $form;
if ($this->getRequest()->isPost())
{ // is post type request has been made
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData))
{ // form elements has been validated
$quoteId = $form->getValue('quoteId');
$providerQuoteStatus = $form->getValue('providerQuoteStatus');
$this->_helper->redirector('lead'); // redirect back
// $this->_forward('leads');
}
$form->populate($formData);
}
}