zend-form

Action View Helper in Zend - Work around?

送分小仙女□ 提交于 2019-12-29 06:15:06
问题 I'm working on building up an interface that I want to function as a "tabbed browsing" sort of function. Each of these tabs has already been written as an action and the tabbed interface works fine as links to the individual tabs. I decided to try writing the "index" page for this controller - putting the content of all the tabs into hidden divs and swapping between them with jQuery, but once I started to use the action view helper - I ran into a lot of people saying that its bad practice.

Zend File Upload and Element Decorators

末鹿安然 提交于 2019-12-28 04:31:07
问题 I have the problem, that the following Zend Form throws an error. The problem is the "file"-element and using setElementDecorators. class Products_AddForm extends Zend_Form { function init() { // other form elements... $uploadElement = new Zend_Form_Element_File('Excel'); $uploadElement->setLabel('Excel'); $this->addElement($uploadElement); $this->setElementDecorators(array( 'ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'th')),

Rename nama in upload ZF2 + AWS S3

六眼飞鱼酱① 提交于 2019-12-25 11:01:13
问题 How can I rename the name of a file before to upload zf2 and Amazon S3? This is my code: $files = $request->getFiles(); $bucketname = 'mybucket'; $result = $aws->putObject(array( 'Bucket' => $bucketname, 'Key' => 'user/5/'.$files['image-file']['name'], 'Body' => EntityBody::factory(fopen($files['image-file']['tmp_name'], 'r')), 'ACL' => CannedAcl::PUBLIC_READ, 'ContentType' => 'image/jpeg' )); I can not use the module https://github.com/aws/aws-sdk-php-zf2 回答1: This is a working example t

Is it possible to show and hide sub form onclick in a Zend form

荒凉一梦 提交于 2019-12-25 05:08:09
问题 Just wondering whether is it possible to show and hide a subform within a zend form on either a radio check event or button onclick event. As I have a form with user field elements and now I want a sub form with password elements which will give the user the ability to optionally change their password. However I only want to show the password elements on request (ie: click a radio button 'Change Password' and the change password elements appear). Is this possible with Zend\Form or would I

Zend_Form how to put <a> behind input text?

末鹿安然 提交于 2019-12-25 03:36:19
问题 I try to put some HTML link behind input text and I try to do it's somthing like this: $aElements[$iKey] = $oName = new Zend_Form_Element_Text($aValue['newsletter_question_answer_id']); $oName->addDecorator('HtmlTag', array( 'tag' => 'a', 'href'=>'http://some_url.html', 'placement' => Zend_Form_Decorator_Abstract::APPEND )); and my question is how can I put somthing between <a> and </a> ? Best Regards 回答1: If You don't want to write Your own decorator You have to use callback: $element-

Zend - form doesn't get validated

荒凉一梦 提交于 2019-12-25 03:34:43
问题 I'm trying to validate a form in the actual form itself, but it doesn't get validated at all. If I type "someemail&*!([]@gmail.com", it doesn't really give a crap and moves on. Form: class RecoverPasswordForm extends Form { public function __construct($options = null) { parent::__construct("RecoverPassword"); $username = new Element("username"); $username->setLabel("Email"); $username->setAttributes( array('filters' => array( array('name' => 'StringTrim'), array('name' => 'StripTags')),

Zend Framework 2 - Set prefix for form elements

给你一囗甜甜゛ 提交于 2019-12-25 02:52:22
问题 I'm looking for a way to add prefixes for every element of a certain form. If found this post telling me that there is a elementsBelongTo option which I can use to achieve what I want. Unfortunately I can't find any documentation explaining the usage. Does anyone know how I can use this option? And if it's still in ZF2? And furthermore: I there a way to combine it with the nice AnnotationForms ? 回答1: Don't know if it will help, but instead of prefix you can wrap elements in form or fieldset

Zend Framework 2 - Set prefix for form elements

試著忘記壹切 提交于 2019-12-25 02:52:06
问题 I'm looking for a way to add prefixes for every element of a certain form. If found this post telling me that there is a elementsBelongTo option which I can use to achieve what I want. Unfortunately I can't find any documentation explaining the usage. Does anyone know how I can use this option? And if it's still in ZF2? And furthermore: I there a way to combine it with the nice AnnotationForms ? 回答1: Don't know if it will help, but instead of prefix you can wrap elements in form or fieldset

Set 'selected' value in select box dropdown list - based on first letter

拈花ヽ惹草 提交于 2019-12-25 02:24:52
问题 I have a zend form that has a select box with 1000+ id->name options sorted alphabetically. When rendered and looking at it in a browser, if you type Ch it goes all the way to that option; Is there a way I can set the value to be selected via the first few letters after the form has been initialized? In other words $form->getElement('name')->setSelected('Ch') or similar; I know that with setValue(34) I can set the name to be selected that has the ID 34. 回答1: Just wrote the code myself class

What is the proper syntax for describing a <SELECT> form element to Zend_Form using XML as the config?

时光毁灭记忆、已成空白 提交于 2019-12-24 19:23:09
问题 I am using an XML config file to tell Zend_Form what elements I want. I would like to have a <select> element, but I am unsure as to how to add <option> tags using the XML syntax. Sure I am missing something pretty basic. Ben 回答1: Programmatic forms in the ZF only support the parameters type, name and options (not in the meaning of choices but of element settings, like required or label) for the form elements. It is assumed that multiple values will be set dynamically, e.g: $formConfig = new