For the purposes of styling I have the need to put an opening <div> at the beginning of one element, and a closing </div> tag at the end of another. Looking over the docs for HtmlDecorator I can't seem to figure out how to get it right, or if this is even the right decorator to use. It seems wasteful to have to create my own decorator si...
Hello,
I would like to change the default behavior of Zend_Form, so that whenever the submit button is clicked, form submission is prevented and an arbitrary JavaScript function is called. This would be done for all forms on the site, however the actual JS function to call may change from form to form.
What would be the most proper way...
Hi all,
I've got a question regarding sub forms.
Currently I've got 2 sub forms and one parent form. On one of the sub forms I want to get data from the model and this needs to be displayed in a table, the first column needs to have a radio button as I want to know which row has been selected. But as a table isn't a form element how ca...
This question is specific to Zend_Form. Zend_Form adds standard decorators such as <dd> <dt> <dl>. What do I lose if I were to remove them? Are they used by Zend_Form itself for error reporting or any other reason?
...
Is there any real difference between the behavior or output of these 2. They look to me like they do the same thing.
->addValidator('NotEmpty')
->setRequired(true)
...
In my index/index action, I'm calling a form class that I created, and output the form in the index.phtml view like this
<?php
echo $this->form;
But when I view the page source, all I'm getting is the form markup. I don't get any HTML HEAD BODY tags to make this a valid markup page. How do I add these to all my pages?
I have layouts/...
This might sound like an odd scenario, but I've got two forms on one page. One is just posting back to itself. I made the second post to another action to keep the code cleaner. Maybe not the right choice...
The problem I'm having now is that if that second form doesn't validate, I redirect back to the page with the form but I don't kno...
I've set a validator for the email so it can't be empty.
This is the markup of the usual form that zend_form generates:
<dt id="email-label"><label class="required" for="email">Email</label></dt>
<dd id="email-element">
<input type="text" value="" id="email" name="email">
</dd>
When validation fails, zend_form adds a new ul class...
In a custom decorator, I'm wrapping the element content with a div. This code creates a div around both the <dt> label and the <dd> element
public function render($content)
{
return '<div class="test">' . $content . '</div>';
}
Is there a way I can further access those 2 parts, the dd and dt. Such as maybe wrap the div arou...
Hi
I have the following form:
<?php
class Application_Form_RegistrationForm extends Zend_Form{
public function init(){
$country = $this->createElement('select', 'country');
$country->setLabel('country: ')
->setRequired(true);
$email = $this->createElement('text', 'email_address');
...
I usually instantiate my forms in an action and that's where I process them when they're submitted. I then pass them on to the view and output them there as usual.
This form (a search box) is different because it's not part of a single page. It has to be visible everywhere. I've made it part of the template layout.phtml and instantiated...
Zend adds an enctype to all forms. What's that good for? and how can I remove it?
<form action=""
method="post"
enctype="application/x-www-form-urlencoded"
id="myform">
</form>
...
I'm a little confused about the StripTags filter as used in Zend. I think it's meant to strip tags that could result in XSS. So shouldn't that mean it should be used when outputting data in the views? I've seen it being used with form inputs
->addFilter('StripTags')
Should it be used with both input in the forms and output in the vie...
Here is my code:
<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$this->_forward('search');
}
public function searchAction()
{
if($this->getRequest()->isGet())
{
$form = $this->getForm();
$value = $form->getValue('search...
Hi
I'm working on a system and i have a form where i need to do cross validations. By cross validation i mean : if someone is from the united states the system must be able to check if the state that have been selected is a valid united states state and not a canadian province. Ideally, the error output message should be beside the faut...
I have a zend form which is using a view script. I want to get access to the individual radio button items but I'm not sure how to do so. Right now, I just print them all out using:
echo $this->element->getElement('myRadio');
That prints them all out vertically. I need a little more control. I need to be able to print the first 5 opti...
I would like to create a Zend_Form with nested checkboxes. I'm sure that it's possible, but I don't remember how to do it. This is what it would look like:
[x] Top level checkbox 1
[ ] Sub level 1
[x] Sub level 2
[ ] Top level 2
[ ] Sub level 1
[ ] Sub level 2
How would I achieve this result?
...
The Zend Framework is mainly meant for MVC use. One of the very usefull components is Zend_Form.
I have a bit trouble finding the place of Zend_Form. Is it part of the view, model, or controller and which responsibilities should I give it.
The thing is, Zend_Form does two things: decorate and render the form and validate it. The first ...
Hi all,
I used to have this form element to validate an email and display an error message if the format was invalid:
$email_users = new Zend_Form_Element_Text('email_users');
$email_users->setLabel('Email:')
->setRequired(false)
->addFilter('StripTags')
->addFilter(...
Does anyone have an example of how to test a custom Zend_Form that extend from that class with PHPUnit?? I may need to test the construct and the init... where i'm adding elements to the My_Custom_Zend_Form.
...