Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.
Yep, $tmpdir is empty. That must mean none of the entire _getTmpDir method works in my environment, at least in the context of $adapter->getFileName(). Looking over the _getTmpDir method it, I find that... if (empty($this->_tmpDir)) { // Attemp to detect by creating a temporary file $tempFile = tempnam(md5(uniqid(rand(), TRUE)), ''); if ($tempFile) { $tmpdir = realpath(dirname($tempFile)); unlink($tempFile); } else { require_once 'Zend/File/Transfer/Exception.php'; throw new Zend_File_Transfer_Exception('Could not determine temp directory'); } } it enters this conditional statement, yet seems to escape it without throwing that exception. so the tempfile check isn't working. not 100% sure what you guys are trying to do with this check, but whatever it is, it's not working on my server :) On Wed, Dec 17, 2008 at 4:53 PM, Thomas Weidner wrote: > Cameron, > > to go further with debugging you can see that your exception is called in > the file Abstract on line 948. > Now simply output the destination directory on line 947 so you can see > which directory you set. > > Then check if the directory which is set there > * does exist > * has write access > > Do this checks within your application as your user can have other rights > than the webserver. > > I am sure you will see where the problem is. > > To note: > This is default debugging strategy... there is no magic ZF action or > knowledge necessary. :-) > > Greetings > Thomas Weidner, I18N Team Leader, Zend Framework > http://www.thomasweidner.com > > - Original Message - From: "Cameron" > To: "Thomas Weidner" > Cc: "Zend Framework - General" > Sent: Wednesday, December 17, 2008 1:59 AM > > Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File. > > > here's the full $e. >> >> http://pastebin.com/m5d442e15 >> >> the line in my code, line 83, that is definitely where it is calling >> $adapter->getFileName(). >> >> On Tue, Dec 16, 2008 at 7:01 PM, Thomas Weidner > >wrote: >> >> Cameron, >>> >>> when you have unexpected exceptions somewhere in your code it's always >>> usefull to get the whole exception and not only the rethrown content. >>> >>> This would be really helpfull, not only for ZF but for every generic >>> problem where exceptions are thrown. >>> >>> Greetings >>> Thomas Weidner, I18N Team Leader, Zend Framework >>> http://www.thomasweidner.com >>> >>> - Original Message - From: "Cameron" >>> To: "Thomas Weidner" >>> Cc: "Zend Framework - General" >>> Sent: Tuesday, December 16, 2008 10:47 AM >>> Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File. >>> >>> >>> >>> Yeah ok, so that's all a bit messy/broken, but I've cleaned it up and >>> it's >>> still doing the same thing: here's the cleaned up code in a pastebin: http://pastebin.com/m5bab1a44 the output is: Array ( [0] => bbbThe given destination is no directory or does not exist ) To test and make sure, i reverted to 1.7.0, still works fine. On Tue, Dec 16, 2008 at 5:31 PM, Thomas Weidner >>> >wrote: Hy Cameron, > > Why should the first catch, catch anything when there is a failure ? > According to manual, receive() returns a false on failure, not an > exception. > > Also you are calling getFileName in any case, regardless if the form is > valid or not. > > Greetings > Thomas Weidner, I18N Team Leader, Zend Framework > http://www.thomasweidner.com > > - Original Message - From: "Cameron" > To: "Zend Framework - General" > Sent: Tuesday, December 16, 2008 7:25 AM > Subject: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File. > > > > if ($form->isValid($formData)) { > > //the form is valid, finish moving the file about >> >> $adapter = new Zend_File_Transfer_Adapter_Http(); >> if ($adapter->isValid() === false) { >> print_r($adapter->getMessages()); >> } >> >> try { >> $adapter->setDestination($path . >> "/$src_class/$foreign_id") >> ->receive(); >> } catch (Exception $e) { >> $errors[] = $e->getMessage(); >> } >> } >> >> if (!$errors) { >> //if there are no errors with things so far, add a db >> record. >> try { >> $this->_model->add(array('foreign_id' => $foreign_id, >> 'filename' => $adapter->getFileName(), 'src_class' => $src_class, >> 'type' >> => >> $formData['newform']['type'])); >> } >> catch (Exception $e
Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.
Looking at the code this method tries to detect the temporary path when there is no path set. But it is only called when you do not set a target directory. You could simply prevent this by setting a own path with setDestination() when the detection does not work in your environment. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Cameron" To: "Thomas Weidner" Cc: "Zend Framework - General" Sent: Wednesday, December 17, 2008 9:54 AM Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File. Yep, $tmpdir is empty. That must mean none of the entire _getTmpDir method works in my environment, at least in the context of $adapter->getFileName(). Looking over the _getTmpDir method it, I find that... if (empty($this->_tmpDir)) { // Attemp to detect by creating a temporary file $tempFile = tempnam(md5(uniqid(rand(), TRUE)), ''); if ($tempFile) { $tmpdir = realpath(dirname($tempFile)); unlink($tempFile); } else { require_once 'Zend/File/Transfer/Exception.php'; throw new Zend_File_Transfer_Exception('Could not determine temp directory'); } } it enters this conditional statement, yet seems to escape it without throwing that exception. so the tempfile check isn't working. not 100% sure what you guys are trying to do with this check, but whatever it is, it's not working on my server :) On Wed, Dec 17, 2008 at 4:53 PM, Thomas Weidner wrote: Cameron, to go further with debugging you can see that your exception is called in the file Abstract on line 948. Now simply output the destination directory on line 947 so you can see which directory you set. Then check if the directory which is set there * does exist * has write access Do this checks within your application as your user can have other rights than the webserver. I am sure you will see where the problem is. To note: This is default debugging strategy... there is no magic ZF action or knowledge necessary. :-) Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Cameron" To: "Thomas Weidner" Cc: "Zend Framework - General" Sent: Wednesday, December 17, 2008 1:59 AM Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File. here's the full $e. http://pastebin.com/m5d442e15 the line in my code, line 83, that is definitely where it is calling $adapter->getFileName(). On Tue, Dec 16, 2008 at 7:01 PM, Thomas Weidner wrote: Cameron, when you have unexpected exceptions somewhere in your code it's always usefull to get the whole exception and not only the rethrown content. This would be really helpfull, not only for ZF but for every generic problem where exceptions are thrown. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Cameron" To: "Thomas Weidner" Cc: "Zend Framework - General" Sent: Tuesday, December 16, 2008 10:47 AM Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File. Yeah ok, so that's all a bit messy/broken, but I've cleaned it up and it's still doing the same thing: here's the cleaned up code in a pastebin: http://pastebin.com/m5bab1a44 the output is: Array ( [0] => bbbThe given destination is no directory or does not exist ) To test and make sure, i reverted to 1.7.0, still works fine. On Tue, Dec 16, 2008 at 5:31 PM, Thomas Weidner wrote: Hy Cameron, Why should the first catch, catch anything when there is a failure ? According to manual, receive() returns a false on failure, not an exception. Also you are calling getFileName in any case, regardless if the form is valid or not. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Cameron" To: "Zend Framework - General" Sent: Tuesday, December 16, 2008 7:25 AM Subject: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File. if ($form->isValid($formData)) { //the form is valid, finish moving the file about $adapter = new Zend_File_Transfer_Adapter_Http(); if ($adapter->isValid() === false) { print_r($adapter->getMessages()); } try { $adapter->setDestination($path . "/$src_class/$foreign_id") ->receive(); } catch (Exception $e) { $errors[] = $e->getMessage(); } } if (!$errors) { //if there are no errors with things so far, add a db record. try { $this->_model->add(array('foreign_id' => $foreign_id, 'filename' => $adapter->getFileName(), 'src_class' => $src_class, 'type' => $formData['newform']['ty
Re: [fw-general] best method to get people to the error controler/404 header
Try this: throw new Zend_Controller_Action_Exception('', 404); Should work ;) Giuliano summertime wrote: > > > I've got my error controller basically working, but I'm stumped on the > best way to get people to it from other areas. Say my products controller > can't find product123 in the database. I'd like to send the user a 404 > header and the error page. I thought I would do something to the effect > of > > $this->_redirector = $this->_helper->getHelper('Redirector'); > $this->_redirector->setCode(303) > ->setGotoSimple("error", > "error"); > > but I just not getting it. > > thanks > summer > > > -- View this message in context: http://www.nabble.com/best-method-to-get-people-to-the-error-controler-404-header-tp21035152p21049847.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] zend form decorators
Great, I found the problem and the solution. So if anyone is interested in it... here it is: class MyForm extends Zend_Form { // the decorators public $formDecorators = array( 'FormElements', 'Form' ); public $elementDecorators = array( 'ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('requiredSuffix' => ' *', 'tag' => 'td', 'style' => 'width: 225px;')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')) ); public $groupDecorators = array( 'FormElements', array('HtmlTag', array('tag'=>'table')), 'Fieldset' ); // the construct public function __construct($action = '#', $description = '') { parent::__construct ( $action, $description ); $this->setAttrib('accept-charset', 'UTF-8'); $this->setAction($action) ->setMethod('post') ->setDecorators($this->formDecorators) ->setDisableLoadDefaultDecorators(true); $this->setName('formname'); $this->setAttrib('enctype', 'multipart/form-data'); $formElements[] = self::createElement('text', 'field1') ->setLabel('field 1') ->setDecorators($this->elementDecorators); $formElements[] = self::createElement('text', 'field2') ->setLabel('field 2') ->setDecorators($this->elementDecorators); self::addElements($formElements); self::addDisplayGroup( array('field1','field2'), 'main', array( 'disableLoadDefaultDecorators' => true, 'decorators' => $this->groupDecorators, 'legend' => 'Basisgegevens' ) ); /* * Repeat here everything to add fields to other DisplayGroups (createfields, addelements, * adddisplaygroup) */ $submit = self::createElement('submit', 'submit'); self::addElement($submit); } } ! also hidden fields need to be added to a displaygroup unless you add them all at the and like I did with the submit button. - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/zend-form-decorators-tp21054571p21058134.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Session oddity
I'm having a strange issue with Zend_Session where I am assigning a string and an object to the same Session Namespace. The object will persist, but the string won't...I open/start the namespace in init() since I need access to the session data throughout my controller. I then assign the session data to a local var in my action for convenience. Not sure if the way I'm assigning vars is the problem, but in any case the object is persisting and the string var isn't: public function init() { //load session vars $this->sessionVars = new Zend_Session_Namespace('collection'); //assign string to session as "activeAlbum" $this->sessionVars->activeAlbum = "top"; $this->activeAlbum = $this->sessionVars->activeAlbum; //assign object "Album" to session as "currentAlbum" $this->sessionVars->currentAlbum = new Album($name='top'); $this->currentAlbum = $this->sessionVars->currentAlbum; } public function listAction() { //assign string to local var: DOESN'T PERSIST $currentAlbum = $this->currentAlbum; //assign Album object to local var: PERSISTS $activeAlbum = $this->activeAlbum; do stuff with $currentAlbum, $activeAlbum, but $currentAlbum won't persist... } Any ideas? -- View this message in context: http://www.nabble.com/Session-oddity-tp21058169p21058169.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Session oddity
I should clarify that the string var does get (and persist) the initial assignment of "top", but subsequent changes to the var doesn't persist--the value can change within the action, but at the next invocation of the action, the value of the string is still the initial value ("top" in this case)... spaceage wrote: > > I'm having a strange issue with Zend_Session where I am assigning a string > and an object to the same Session Namespace. The object will persist, but > the string won't...I open/start the namespace in init() since I need > access to the session data throughout my controller. I then assign the > session data to a local var in my action for convenience. Not sure if the > way I'm assigning vars is the problem, but in any case the object is > persisting and the string var isn't: > > > public function init() { > //load session vars > $this->sessionVars = new Zend_Session_Namespace('collection'); > > //assign string to session as "activeAlbum" > $this->sessionVars->activeAlbum = "top"; > $this->activeAlbum = > $this->sessionVars->activeAlbum; > > //assign object "Album" to session as "currentAlbum" > $this->sessionVars->currentAlbum = new Album($name='top'); > $this->currentAlbum = > $this->sessionVars->currentAlbum; > } > > public function listAction() { > //assign string to local var: DOESN'T PERSIST > $currentAlbum = $this->currentAlbum; > > //assign Album object to local var: PERSISTS > $activeAlbum = $this->activeAlbum; > >do stuff with $currentAlbum, $activeAlbum, but > $currentAlbum won't persist... > } > > Any ideas? > > -- View this message in context: http://www.nabble.com/Session-oddity-tp21058169p21058333.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Validation against another field in zend dojo form
I'v tried solution i found here in forum but it wont work for me. So, my code looks is: $form->addElement('ValidationTextBox', 'password', array ( 'value' => $webmasterData [ 0 ] [ 'password' ] , 'label' => 'Password' , 'maxlength' => 20 , 'regExp' => '\w{6,}' , 'required' => true , 'invalidMessage' => 'Password must be longer then 6 characters.' , 'filters' => array ( 'StringTrim' , 'StringToLower' ) , 'validators' => array ('NotEmpty', array ('StringLength' , true , array (6 , 20) ) , array ('Regex' , true , array ('/\w+/i'))) ))->addElement('ValidationTextBox', 'repeatpassword', array ( 'label' => 'Repeat Password' , 'maxlength' => 20 , 'required' => true , 'filters' => array ( 'StringTrim' , 'StringToLower' ) , 'validators' => array ( 'Identical' , 'password' ) )) This wont work, and i can enter whatever i want in Repeat Password field. How to fix that? Thanks, V -- View this message in context: http://www.nabble.com/Validation-against-another-field-in-zend-dojo-form-tp21052614p21052614.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] zend form decorators
I'm totally lost in the zend forms decorators. Hopefully someone can help me... I want to create a form view like this main label 1field 1 label 2field 2 ... bla bla ... I'm working with DisplayGroups. So each fieldset is a displaygroup. But I'm not getting it right. :confused: - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/zend-form-decorators-tp21054571p21054571.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] [Dojo][Form][Layout][non MVC] Submit button does nothing
Hi everyone, I am encoutering a strange behaviour with Zend_Dojo_Form object. I am adding a section using ZF to an existing application. Therefore new functionnalities are based on the MVC architecture. But I would like that older functionnalities could use some of the advantages of ZF without using MVC. In this case, I make use of ZF as a library of components and not as a whole Framework. This point is explained in the DOC when using Zend_Layout. What I have done : 1°) a Zend_Layout object calling the layout.phml view script that displays the main frame of application (header, menu, content zone and footer) and which is Dojo enabled. 2°) an object I have made which internally owns a Zend_Dojo_Form instance with some Elements (Zend_Dojo_Form_Element_ValidationTextBox, Hidden, Zend_Dojo_Form_Element_SubmitButton ...). So when I create an instance of my object, a form object is ready to be rendered and represents the HTML input form of the object. 3°) the script called by the URL which manages all of this : - create the instance of my class ($myobject), - create the layout instance object ($layout), on which I only set the layout path $layout->setLayoutPath($mypath) ) so that it makes use of the view script layout.phtml - bind the Zend_Dojo_Form of my object to the layout view instance : $myobject->setView( $layout->getView() ); - render the Zend_Dojo_Form object and put the result in the layout placeholder that is called by the layout view (in my case, I use the default render segment content) : $layout->content = $myobject->renderForm(); - finally, ask the layout object to render itself : $layout->render(); Everything is working, no errors, my layout is correctly displayed, the content part contains the form with all my widgets and Dojo is initialized. But, when I click on my submit button : nothing. My action page is not called, firebug console reports no error or warning. I don't think, the submit button is in cause because I tried to add a simple into the form and the behaviour is the same. I only got my form to work when dojo environnement is disabled into my layout view script. I simply commented out the call to the DOJO helper, so that JS includes are skipped : $this->dojo() In this case, as my form is not DOJO-enabled ( this can easily be noticed because the tundra theme is not applied to form elements ) The MVC sections of my application make use of the same layout object but in this case, it is initialized to use the front controller and its properties. I have a page which use a Zend_Dojo_Form and renders itself through the layout and of course the submit button is doing its job. I can't find the origin of such a behaviour. there must be something missing between the form and the layout but what ? Anybody could help me ? Thanks Nico -- View this message in context: http://www.nabble.com/-Dojo--Form--Layout--non-MVC--Submit-button-does-nothing-tp21049937p21049937.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend Form dynamic content
Hello, I am looking for some information on using Zend_Form. I want to use Zend_Form to have dynamic drop downs and options based on what a user selected before. I am re-writing an app, so I can not change this behavior too much. Let me give you a very brief example of how the form used to work, based on a form most people are familiar with: Honda Ford Toyota function getModels(obj) { // use ajax call and response to populate model select } function getYears(obj) { // use ajax call and response to populate years select } Now, what is the correct way to re-create this behavior with Zend_Form? I know inline javascript is frowned upon. My experience is with the Prototype js library for the ajax calls. Thank you for the help. -- View this message in context: http://www.nabble.com/Zend-Form-dynamic-content-tp21059688p21059688.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend Form Select Box, use array values as value=""
Hello, i am building a zend_form that has a select box in it. The values for the select box come from an array such as: array( 'a' => 'First', 'b' => 'Two'); I want the values and the visible label of the select box to be the values of the array such as: First Two Is there an option or flag to set wen building the select box element to do this, or do I need to iterate through the array and create a new one with the values as the key? Thanks. -- View this message in context: http://www.nabble.com/Zend-Form-Select-Box%2C-use-array-values-as-value%3D%22%22-tp21054568p21054568.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Insert HTML / JS in to middle of a zend_form
I have been through a number of examples, but dont think I have found/understand what i need to do. I have a form that i want the rendered html to look like this (or similar): First Name: javascript:document.myform.getElementByID('first_name').value click here Last Name: I have a zend form created by: class My_Forms_Names extends Zend_Form{ public function init() { $this->addElement('text', 'first_name', array( 'filters' => array('StringTrim'), 'validators' => array( 'Alpha', array('StringLength', false, array(2, 50)), ), 'required' => true, 'label' => 'First Name', 'class' => 'text', )); $this->addElement('text', 'last_name', array( 'filters' => array('StringTrim'), 'validators' => array( 'Alpha', array('StringLength', false, array(2, 50)), ), 'required' => true, 'label' => 'Last Name', 'class' => 'text', )); $this->addDisplayGroup( array('first_name', 'last_name'), 'nameinfo', array( 'disableLoadDefaultDecorators' => true, 'decorators' => array( 'FormElements', array('HtmlTag', array('tag'=>'ol')), 'Fieldset' ), 'legend' => 'Trips:', ) ); } } I want to be able to insert ' javascript:document.myform.getElementByID('first_name').value click here ' in between the two name fields. Any suggestions or examples would be great. Thank you. -- View this message in context: http://www.nabble.com/Insert-HTML---JS-in-to-middle-of-a-zend_form-tp21057511p21057511.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Best practice to create sidebar with a couple of content blocks
Hi Matthew and Vincent, so, the placeholder view helper seems to be the first choice at the moment. I will have a closer look into that. Thanks for your comments. Best regards, Ralf
[fw-general] Zend Framework for openSUSE
Greetings list, I've just built some rpm packages for openSUSE to be hosted on the openSUSE build service. There are packages for openSUSE 10.3, 11.0 and 11.1 Installation instructions and details are on the wiki as follows. Please note the separate packages and instructions for APC/memcache backends and PDF/Captcha. http://framework.zend.com/wiki/display/ZFDEV/Unix+and+Linux+Distribution+Packages 11.1 went GM last week and will be released tomorrow so there are packages waiting for it. Sorry no packages for 10.2 this version has gone end of life with the last patches for it being shipped last week. All feedback gratefully received, in future I'll supply meta packages through pattern files so that the separation of packages is not such a hassle. With a bit of tweaking I'd like to get ZF bundled in the main openSUSE PHP repo. Cheers the noo Graham
Re: [fw-general] [Zend_Form] Zend_Form_Element_File::getValue() is calling Zend_File_Transfer_Http:: receive()
getValue() receives the file. And you add the filter afterwards in your code... But as the files are already received you can not apply the filters. The files are already there so a later receive would not receive the files again. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "paperogiallo" To: Sent: Wednesday, December 17, 2008 5:14 PM Subject: Re: [fw-general] [Zend_Form] Zend_Form_Element_File::getValue() is calling Zend_File_Transfer_Http:: receive() thomasW wrote: Hy, So the logical way in my opinion would be to call getFileName, change the name according to the primary key of the database by applying the rename filter, and then, as last step calling getValues(). If validation or anything other fails, revert db entry. You could even validate before attaching the rename filter because validation does not receive the file. if ($file->isValid()) { $file->getFileName(); get id, rework filename $file->addFilter('rename', $newfilename); ->getValues(); } If I undestood, this way you can't insert data into db calling $form->getValue(), like I'm used to do: if($form->isValid()){ $id = $this->dbTable->insert($form->getValue()); $this->getElement('fileUpload')->addFilter('Rename',$id.'.jpg'); } ...meaning getValue() method of Zend_Form is useless for those form using Zend_Form_Element_File... or had I miss something? -- View this message in context: http://www.nabble.com/-Zend_Form--Zend_Form_Element_File%3A%3AgetValue%28%29-is-calling-Zend_File_Transfer_Http%3A%3A-receive%28%29-tp20818332p21055532.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Insert HTML / JS in to middle of a zend_form
you will need a decorator on your first element, with placement set to 'append' or a decorator on the second element, with placement set to 'prepend'. There is a lot on decorators in the manual and on devzone. Bart maxarbos schreef: I have been through a number of examples, but dont think I have found/understand what i need to do. I have a form that i want the rendered html to look like this (or similar): First Name: javascript:document.myform.getElementByID('first_name').value click here Last Name: I have a zend form created by: class My_Forms_Names extends Zend_Form{ public function init() { $this->addElement('text', 'first_name', array( 'filters' => array('StringTrim'), 'validators' => array( 'Alpha', array('StringLength', false, array(2, 50)), ), 'required' => true, 'label' => 'First Name', 'class' => 'text', )); $this->addElement('text', 'last_name', array( 'filters' => array('StringTrim'), 'validators' => array( 'Alpha', array('StringLength', false, array(2, 50)), ), 'required' => true, 'label' => 'Last Name', 'class' => 'text', )); $this->addDisplayGroup( array('first_name', 'last_name'), 'nameinfo', array( 'disableLoadDefaultDecorators' => true, 'decorators' => array( 'FormElements', array('HtmlTag', array('tag'=>'ol')), 'Fieldset' ), 'legend' => 'Trips:', ) ); } } I want to be able to insert ' javascript:document.myform.getElementByID('first_name').value click here ' in between the two name fields. Any suggestions or examples would be great. Thank you.
[fw-general] OT: Zend Framework logo in eps format
Hey there, I'm preparing for a launch party and need to get some t-shirts ready. I'm looking for the ZF logo in a scalable format but haven't found any. Someone knows if it exists? Regards Thorsten
[fw-general] View Helpers or Three Step View
Hi All, If I have view script like this .phtml --- // other code // --- code that will be used on several view scripts data)): ?> data as $v):?> title ?> Proposed By cby) ?> Time : cbo ?> description ?> target ?> // end //other code and, .phtml --- // other code // --- code that will be used on several view scripts data)): ?> data as $v):?> title ?> Proposed By cby) ?> Time : cbo ?> description ?> target ?> // end //other code Is possible to set three step view to avoid doing the same thing? Or we can utilize View Helpers to solve it? Thanks in advance, bn
[fw-general] Dependant dropdown lists in a form using FilteringSelect and Dojo
Hi all, I want to implement a dependant dropdown lists for a FilteringSelect elements using Dijit widgets and Ajax in a form. And I can't figure out how to do this. When we choose an item on one dropdown list, the other list should be updated automatically by fetching the database (using Ajax). Any ideas? Thanks. -- View this message in context: http://www.nabble.com/Dependant-dropdown-lists-in-a-form-using-FilteringSelect-and-Dojo-tp21061444p21061444.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend Form Select Box, use array values as value=""
maxarbos wrote: > Hello, > > i am building a zend_form that has a select box in it. > > The values for the select box come from an array such as: > array( 'a' => 'First', 'b' => 'Two'); > > I want the values and the visible label of the select box to be the values > of the array such as: > > First > Two > > Is there an option or flag to set wen building the select box element to do > this, or do I need to iterate through the array and create a new one with > the values as the key? > > Thanks. > > No need to iterate through the array, you can get the array you want by: $arr = array('a' => 'First', 'b' => 'Second'); $arr2 = array_combine($arr, $arr); But no, I don't think there is an option on the select box. signature.asc Description: OpenPGP digital signature
Re: [fw-general] quoteOutOf?
Thanks, Set magic_quotes_gpc Off helped me out. Matthew Weier O'Phinney-3 wrote: > > -- Mauricio Cuenca wrote > (on Thursday, 27 March 2008, 05:20 AM -0700): >> This post just gets me more confused, because I'm using $db->quote() in >> almost all my inserts, but when I get the data back, all my carriage >> returns >> are converted to \n\r > > The above is likely something to do with your database or with the input > provided, not with Zend_Db. > >> and single quotes become \'. I also used PHP's >> stripslashes() but has no effect on carriage returns. > > My guess is that you have magic_quotes_gpc on, so data is getting into > the database with quotes escaped. Please make sure this setting is off. > > Zend_Db_Adapter::quote() itself will only escape quotes for insertion; > when you get them back from the database, they will not be quoted. What > *can* happen, however, is double escaping, which typically happens when > you have magic_quotes_gpc on *and* use a tool such as > Zend_Db_Adapter::quote(); this leads to the exact situation you've > described. > >> Is there an effective way to "unquote" results that where inserted using >> quote() ? >> >> Thanks! >> >> Mauricio >> >> >> >> Matthew Ratzloff wrote: >> > >> > Hi Jared, >> > >> >> I'm just now learning all the intricacies of preventing SQL injection >> >> attacks. I understand the value of using Zend_Db quoting for values >> that >> >> can be manipulated by users.. what I can't find, though, is a good >> >> "unescape" command. >> >> >> >> If I have an article, for example, that I want to store and then >> retrieve >> >> and display, I'll quote the article before insertign it. This will, >> >> ofcourse, escape all quotes, but it will also put a set of single >> quotes >> >> around my entire article. When I then retrieve the article and run >> >> "stripslashes()" to unescape the quotes, it leaves the surrounding >> single >> >> quotes. >> > >> > Looking at your example, I think you may be a little confused. >> Escaping >> > certain characters in preparation for use in an SQL statement simply >> > inserts the values as intended to be read by the end user into the >> > database. There's no need to unescape them following a SELECT >> statement >> > because no escape characters are stored in the database record. >> > >> > For anyone else that's curious--without escaping, someone might enter >> the >> > following: >> > >> > Username: admin >> > Password: ' OR '1' = '1 >> > >> > If it's not properly filtered, it could break out of the "AND Password >> = >> > '(password)'" portion of the WHERE clause and return admin without >> > properly authenticating them. >> > >> > Hope that helps, >> > >> > -Matt >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/quoteOutOf--tp6416052p16324521.html >> Sent from the Zend Framework mailing list archive at Nabble.com. >> > > -- > Matthew Weier O'Phinney > PHP Developer| matt...@zend.com > Zend - The PHP Company | http://www.zend.com/ > > -- View this message in context: http://www.nabble.com/quoteOutOf--tp6416052p21051870.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] [Zend_Form] Zend_Form_Element_File::getValue() is calling Zend_File_Transfer_Http:: receive()
thomasW wrote: > > Hy, > So the logical way in my opinion would be to call getFileName, change the > name according to the primary key of the database by applying the rename > filter, and then, as last step calling getValues(). > If validation or anything other fails, revert db entry. > You could even validate before attaching the rename filter because > validation does not receive the file. > > if ($file->isValid()) { > $file->getFileName(); > get id, rework filename > $file->addFilter('rename', $newfilename); > ->getValues(); > } > If I undestood, this way you can't insert data into db calling $form->getValue(), like I'm used to do: if($form->isValid()){ $id = $this->dbTable->insert($form->getValue()); $this->getElement('fileUpload')->addFilter('Rename',$id.'.jpg'); } ...meaning getValue() method of Zend_Form is useless for those form using Zend_Form_Element_File... or had I miss something? -- View this message in context: http://www.nabble.com/-Zend_Form--Zend_Form_Element_File%3A%3AgetValue%28%29-is-calling-Zend_File_Transfer_Http%3A%3A-receive%28%29-tp20818332p21055532.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend Form Select Box, use array values as value=""
That worked like a champ! Thanks. Brenton Alker-3 wrote: > > maxarbos wrote: >> Hello, >> >> i am building a zend_form that has a select box in it. >> >> The values for the select box come from an array such as: >> array( 'a' => 'First', 'b' => 'Two'); >> >> I want the values and the visible label of the select box to be the >> values >> of the array such as: >> >> First >> Two >> >> Is there an option or flag to set wen building the select box element to >> do >> this, or do I need to iterate through the array and create a new one with >> the values as the key? >> >> Thanks. >> >> > > > No need to iterate through the array, you can get the array you want by: > > $arr = array('a' => 'First', 'b' => 'Second'); > > $arr2 = array_combine($arr, $arr); > > But no, I don't think there is an option on the select box. > > > > > -- View this message in context: http://www.nabble.com/Zend-Form-Select-Box%2C-use-array-values-as-value%3D%22%22-tp21054568p21062065.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend Form Select Box, use array values as value=""
Thanks for the tip, I did the iterations and your solutions is so much simpler! Bart Brenton Alker schreef: maxarbos wrote: Hello, i am building a zend_form that has a select box in it. The values for the select box come from an array such as: array( 'a' => 'First', 'b' => 'Two'); I want the values and the visible label of the select box to be the values of the array such as: First Two Is there an option or flag to set wen building the select box element to do this, or do I need to iterate through the array and create a new one with the values as the key? Thanks. No need to iterate through the array, you can get the array you want by: $arr = array('a' => 'First', 'b' => 'Second'); $arr2 = array_combine($arr, $arr); But no, I don't think there is an option on the select box.
Re: [fw-general] View Helpers or Three Step View
-- Bagus Nugroho wrote (on Wednesday, 17 December 2008, 10:31 PM +0700): > Hi All, > > If I have view script like this > .phtml > --- > // other code > > // --- code that will be used on several view scripts >data)): ?> > data as $v):?> > > title ?> > Proposed By cby) ?> > Time : cbo ?> > description ?> > target ?> > > > > // end > > //other code > > and, > .phtml > --- > // other code > > // --- code that will be used on several view scripts >data)): ?> > data as $v):?> > > title ?> > Proposed By cby) ?> > Time : cbo ?> > description ?> > target ?> > > > > // end > > //other code > > > Is possible to set three step view to avoid doing the same thing? > Or we can utilize View Helpers to solve it? View helpers and partial scripts are your friends here. :) -- Matthew Weier O'Phinney Software Architect | matt...@zend.com Zend Framework | http://framework.zend.com/
Re: [fw-general] Zend Form dynamic content
What I'm doing now is using Zend_Form to create a skeleton of the form with placeholders, then using unobtrusive javascript to hide those fields. Then, when the AJAX response is received those elements are populated and shown. If there's a better way, please let me know. Thanks! KeefTM wrote: > > Hello, I am looking for some information on using Zend_Form. I want to use > Zend_Form to have dynamic drop downs and options based on what a user > selected before. I am re-writing an app, so I can not change this behavior > too much. Let me give you a very brief example of how the form used to > work, based on a form most people are familiar with: > > > > Honda > Ford > Toyota > > > > > > > > > > function getModels(obj) > { > // use ajax call and response to populate model select > } > > function getYears(obj) > { > // use ajax call and response to populate years select > } > > > Now, what is the correct way to re-create this behavior with Zend_Form? I > know inline javascript is frowned upon. My experience is with the > Prototype js library for the ajax calls. Thank you for the help. > -- View this message in context: http://www.nabble.com/Zend-Form-dynamic-content-tp21059688p21065820.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Confused about decorators
Hi all, I have just begun learning ZF. I have come across Decorators and am finding a bit difficult to grasp it. My question is where I need to put my new decorator class in the project folder. It looks like the following: vQuick -application -controllers -models -forms -views -public -library -Zend Following the Zend_Decorator example [http://www.zendframework.com/manual/en/zend.form.decorators.html] I have put the new file in : -library -Zend -Form -Decorator -My -Decorator -Composite.php Am I doing something wrong here? Can someone please help me with this. Thanks Vibhor
RE: [fw-general] Confused about decorators
Just to add I am getting the following error: Message: Plugin by name 'Composite' was not found in the registry; used paths: My_Decorator_: My/Decorator/ Zend_Form_Decorator_: Zend/Form/Decorator/:Zend/Form/Decorator/ _ From: vibhor singh [mailto:vib...@pivisions.com] Sent: Thursday, December 18, 2008 12:00 PM To: fw-general@lists.zend.com Subject: [fw-general] Confused about decorators Hi all, I have just begun learning ZF. I have come across Decorators and am finding a bit difficult to grasp it. My question is where I need to put my new decorator class in the project folder. It looks like the following: vQuick -application -controllers -models -forms -views -public -library -Zend Following the Zend_Decorator example [http://www.zendframework.com/manual/en/zend.form.decorators.html] I have put the new file in : -library -Zend -Form -Decorator -My -Decorator -Composite.php Am I doing something wrong here? Can someone please help me with this. Thanks Vibhor No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.19/1854 - Release Date: 12/17/2008 7:21 PM