zend-form

Zend_Form_SubForm flattening array notation with getValues()

I am working with a series of forms that have subforms embedded into them and I am trying to work out if I can make getValues return the values without the array notation on the subform. ie: $form = new Zend_Form(); $subForm = new Zend_Form_SubForm(); $form->addSubForm( $subForm, 'contact' ); $form->addElement(new Zend_Form_Element_Te...

Zend Framework: Zend Form Select Generate Verbose HTML Using MultiOptions

I have a form that I am trying to add a simple select element to using the following php: $dateFormat = new Zend_Form_Element_Select('dateFormat'); $dateFormat->setLabel('Date Format:'); $dateFormat->setRequired(true)->addValidator('NotEmpty'); $dateFormat->addMultiOptions(array( 'MM/dd/yyyy' => "US S...

Zend_Form loadDefaultDecorators don't apply to subforms

Hi all, Trying to set up a form partly using subforms that i also use elsewhere. I have setup the decorators to utilize UL-LI notation instead of the regular DtDd wrapper. Structure is something like this. RegisterForm + Element, firstname + Element, lastname + SubForm, NoScriptForm [new Olo_AddressApartmentForm()] ...

Zend_Form - is there a way to repost into the form if it is invalid?

I am having trouble injecting form data back into the form so the form is not reset if it is invalid. Any way to do that? Or, more importantly, best/most ideal way? I have my form logic and checking, just need a little help in exactly where I should be focusing the above effort. Thanks! ...

ZEND FORM radiobox with input

Hello, I have this zend form element : $form->getElement('my_element')->addMultiOptions(array('option1' => 'option1', 'option2' => 'option2', 'option3' => 'option3', 'option4' => 'option4')); So I get : ( ) option 1 ( ) option 2 ( ) option 3 ( ) option 4 Now let's say I want to add a input (type = text) right after option 3 .. s...

Zend_Form_Element_MultiSelect element definition

Is there any way to define wich options in Zend_Form_Element_MultiSelect would be selected by default?? ...

Setting default selected option for Zend_Form_Element_Select

I have a Zend_Form with Zend_Form_Select element. I populate it from array (code inside the *Application_Form_MyForm extends Zend_Form* class): $options = array('first option', 'second option', 'third option'); $this->getElement('mySelect')->addMultiOptions($options); How can I choose which value is gonna be selected automatically, as...

How make Zend_Form submission without reload a page - with Ajax?

Hi, How make Zend_Form submission without reload a page - with Ajax? This is code for create form that reload a page when submitted, what should be change or add that this form will submit with ajax (1.regular solution 2.jquery solution): Form: class Application_Form_Login extends Zend_Form { public function init() { $...

Zend Validate - How do you pass context values from a different subform?

I've split up a Form into 3 SubForms and for one of the elements, in the last SubForm, I am creating a Validator that extends Zend_Validator_Abstract. This validator needs to check that a value, on the second SubForm, is not empty. However this value will not be in the $context array for the element in the Third SubForm. What is a sens...

Zend-framework: Post data problem

Hi, I have strange problem. When I submit form, the whole web site redirects to index. Form method is post. When I change it to get, everything goes right. So what is the problem ? Form code: <form action="<?php echo $this->baseUrl('/search/general'); ?>" method="post"> <table class="wf"> <tr> <td> <a href="#" oncl...

ZF Form refuses to POST

I'm perplexed by this. I have a login action that looks like this: public function loginAction() { $form = new Application_Form_Login; $form->setAction("/users/login"); $request = $this->getRequest(); var_dump($request->isPost()); if ($request->isPost() && $form->isValid($request->getPost())) { // snipped c...

Zend From multiselect array

Hi I am using the Zend Framework and have setup a normal Zend Form, what I want to try to achieve is to have a button (with some javascript) that says add more and it adds another drop down menu same as the one setup in the zend form (a clone of it). basically when the button is clicked it adds another select box like so: <select na...

Zend Framework problem with Zend_Form_Element_File in a .ini form

The Zend_Form_File is generating an error: Warning: Exception caught by form: Method getImageValue does not exist Stack Trace: #0 /var/www/vhosts/mp3.al/library/Zend/Form/Decorator/Image.php(137): Zend_Form_Element->__call('getImageValue', Array) #1 /var/www/vhosts/mydomain.al/library/Zend/Form/Decorator/Image.php(137): Zend_Form_Elemen...

zend framework Zend_Form div inside div

Hi, I was browsing stackoverflow in a search for an answer to my question. Basically i want to use Zend_Form to place a div inside a div right beneath an input box. I have found the code below to add a div but now i want another one inside. I need to achieve the html equivalent of <div id = "parentDiv"> <div id = "innerDiv"></div>...

zend get posted variables from static form from the view file

Ok so i tried using zend form but what i'm trying to accomplish is way too much for me to handle zend form. I'll try to describe it in a few lines maybe you have a solution for me if not you will understand why i chose to use a form in a view file. I have a form for searching products in a database. THe search is done using autocomplete...

Zend Form placing some elements in one div

I have the Zend Form with some elements. And I need to placing some elements in first div, some in other div. Part of my form: private function _createForm($action) { $form = new Zend_Form(); $form->setName($action . '_form'); $form->setMethod('post'); $title = $form->createElement('text', 'title'); $title->setLabel('Title') ...

Zend Form elements in div

Hello. I am creating a form, using Zend Form. I have 8 input elements. And I want to placing first 6 elements in one div, and others in second. How I can do this? I am tried to use addDisplayGroup(), but it was unsuccessful. Or may be you know how to create a link in form? ...

Zend Form does not validate input.

Zend Form is not my friend today! This works :- Controller:- public function indexAction() { $loginForm = new Application_Form_Login(); //is there a submitted form? if($this->getRequest()->isPost()){ //yes there is so process it. $formdata = $this->getRequest()->getPost(); if($l...

How to filter and validate user input in Zend Framework

Hi, on my website I have a comment section. I want to filter and validate the input before I store it in my database. If there are any invalid chars in the input the user gets the notice that his input is invalid. My question, which chars are not allowed? e.g. I want to avoid sql injections Tags are not allowed. How do I check that? ...

Zend Form. Adding a href and placing some elements in div.

Hello. I have some zend form. It is my code: private function _createForm($action) { $form = new Zend_Form(); $form->setName($action . '_form'); $form->setMethod('post'); // Main tab $title = $form->createElement('text', 'title'); $title->setLabel('Title') ->setAttrib('maxlength',50)->setAttrib('id',...