zend-form

ZF2 Select element usage

那年仲夏 提交于 2020-01-17 04:48:04
问题 I'm using Zend Framework 2 and I need a Dependent Dropdown. When user select an category (cat_id on my example) the system fills the subcategory (sca_id) with the correct elements. I could do that by creating an application like this: My form looks like: $this->add(array( 'name' => 'cat_id', 'type' => 'Zend\Form\Element\Select', 'options' => array( 'label' => 'Categoria', 'value_options' => array( '' => '', ), ), )); $this->add(array( 'name' => 'sca_id', 'type' => 'Zend\Form\Element\Select',

Zend Form Custom Validation Path issues

人走茶凉 提交于 2020-01-16 13:22:08
问题 The issue: Plugin by name 'Spam' was not found in the registry; used paths: Zend_Validate_: Zend/Validate/ I have this on my bootstrap.php file (it's NOT a class): include_once 'config_root.php'; set_include_path ( $PATH ); require_once 'Initializer.php'; require_once "Zend/Loader.php"; require_once 'Zend/Loader/Autoloader.php'; // Set up autoload. $loader = Zend_Loader_Autoloader::getInstance (); $loader->setFallbackAutoloader ( true ); $loader->suppressNotFoundWarnings ( false ); //resource

How to add File\MimeType Validator in Zend Framework 2 Model Declaration

孤人 提交于 2020-01-16 08:06:26
问题 Actually I'm developing a simple file uploader. In the ImageUploader.php file I define the getInputFilter function, all works unless I try to add a File\MimeType validator: <?php namespace Admin\Model; use Zend\InputFilter\Factory as InputFactory; use Zend\InputFilter\InputFilter; use Zend\InputFilter\InputFilterAwareInterface; use Zend\InputFilter\InputFilterInterface; use Zend\Validator\File\MimeType; //tried also with use Zend\Validator\File; [...] public function getInputFilter() { [...]

how to add special class for labels and errors on zend form elements?

时光怂恿深爱的人放手 提交于 2020-01-15 09:17:09
问题 how we could add a special class for labels and errors for a zend-form-element for example html output code before add classes <dt id="username-label"><label for="username" class="required">user name:</label></dt> <dd id="username-element"> <input type="text" name="username" id="username" value="" class="input" /> <ul class="errors"><li>Value is required and can't be empty</li></ul></dd> and code after we add classes <dt id="username-label"><label for="username" **class="req-username"**>user

ZF2 + Doctrine2 - Fieldset in Fieldset of a Collection in Fieldset does not validate properly

有些话、适合烂在心里 提交于 2020-01-15 07:31:42
问题 I asked a similar question a while ago, which came down to the structuring of the Forms, Fieldsets and InputFilters. I've been thoroughly applying the principle of separation of concerns to split up Fieldsets from InputFilters as the modules they're created in will also be used in an API (Apigility based), so I would need only Entities and InputFilters. However, I now have a problem that when I have a Fieldset, used by a Fieldset, used in a Collection in a Fieldset, that the inner-most

Is there a better way of designing zend_forms rather than using decorators?

℡╲_俬逩灬. 提交于 2020-01-15 03:01:12
问题 I am currently using zend_decorators to add styles to my form. I was wondering if there is an alternative way of doing it? It is a bit difficult to write decorators. I would love the casual one using divs and css style : <input type="submit" class="colorfulButton" > It is much simpler rather than set a decorator for a certain control and add it. Since it requires creating a decorator for each style implementation and adding it up with the control. Will view helpers to the trick? 回答1: There's

Zend Framework notEmpty validator setRequired

僤鯓⒐⒋嵵緔 提交于 2020-01-14 10:47:27
问题 I have looked at other questions/Googled this. My problem is that when I submit my form with empty textboxes that have a notEmpty validator, it triggers no error. First, I would like to see if I understand the difference between notEmpty and setRequired . As I understand, the notEmpty validator gives an error if an element is submitted and the value is empty. That is, if an entry does not exist in the POST data (for forms), then it does not generate an error if the element is not required .

Zend Framework notEmpty validator setRequired

好久不见. 提交于 2020-01-14 10:47:05
问题 I have looked at other questions/Googled this. My problem is that when I submit my form with empty textboxes that have a notEmpty validator, it triggers no error. First, I would like to see if I understand the difference between notEmpty and setRequired . As I understand, the notEmpty validator gives an error if an element is submitted and the value is empty. That is, if an entry does not exist in the POST data (for forms), then it does not generate an error if the element is not required .

Zend_Form : data table with checkboxes

99封情书 提交于 2020-01-14 09:38:14
问题 I'd like to have a table of data coming from the DB in my form element, looking like the following : +-----+-------------------------+-----------------------+ | | Number | Name | +-----+-------------------------+-----------------------+ | [ ] | 123 | ABC | +-----+-------------------------+-----------------------+ | [x] | 456 | DEF | +-----+-------------------------+-----------------------+ | [x] | 789 | HIJ | +-----+-------------------------+-----------------------+ It would allow to select

Zend framework decorators question

孤街浪徒 提交于 2020-01-13 17:39:10
问题 I need to add some random html content with text before and after my input field. I know I can use description decorator and set escape option to false - this way I can simply inject arbitrary html chunk as a decorator. But this only accounts for 1 html chunk - I need a second one after input field. If I simply output description decorator again after input field - that will output the same description chucnk. 1) Is there a way to use description decorator multiple times with different