Re: [fw-general] how to retain value in form using zend
Hi Rohit83, I usually use Zend_Session to keep form data between requests. I serialize the post array an keep it in an own session namespace. Additionally, I pass the form data array to the view in the controller action, so that the view does not need to know about the existence of sessions. Take a look at the sample code below. If everyone has a better idea, I would be happy to know! Best regards, Ivan. /* Display form */ public function displayformAction() { $this-initView(); // Check session for form data $formSession = new Zend_Session_Namespace('form'); if (isset($formSession-formData)) { $formData = unserialize($formSession-formData); $this-view-formData = $formData; } /* Render form */ } /* Check user input */ public function checkformAction() { // Get POST data $request = $this-getRequest(); $post = $request-getPost(); /* Validation logic */ /* If errors, go back to view */ // Pass error message... $this-view-formData = $post; // Redirect /* If input ok */ $formSession = new Zend_Session_Namespace('form'); $formSession-formData = serialize($post); // Go to previewAction, e.g. } Hi All I have developed a form using zend framework.When i click on submit button and id if due to validation some error message is displayed , at that time the values entered in text box will not be retained. Is their any way to retain these values using zend functionality Regard, Rohit83 -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
Re: [fw-general] how to retain value in form using zend
Hi Steven, Using sessions to store form data may lead to data overlapping. That's a good point, I didn't take into account. The main point using the session was to store form data in case that we have a preview action. In this case form data is no longer in the post array. What would be in your opinion the best way to store data in this case? Thanks. Best regards, Ivan. Steven Brown schrieb: I would recommend not storing the form data in the session, you might find people will be using the same form (or multiple forms) in multiple windows, this results in overlapping data. Check out this tutorial: http://akrabat.com/zend-framework-tutorial/ It has a really good example application for forms. Cheers, Steven -Original Message- From: Ivan Ruiz Gallego [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 September 2007 5:03 PM To: rdpweb; fw-general@lists.zend.com Subject: Re: [fw-general] how to retain value in form using zend Hi Rohit83, I usually use Zend_Session to keep form data between requests. I serialize the post array an keep it in an own session namespace. Additionally, I pass the form data array to the view in the controller action, so that the view does not need to know about the existence of sessions. Take a look at the sample code below. If everyone has a better idea, I would be happy to know! Best regards, Ivan. /* Display form */ public function displayformAction() { $this-initView(); // Check session for form data $formSession = new Zend_Session_Namespace('form'); if (isset($formSession-formData)) { $formData = unserialize($formSession-formData); $this-view-formData = $formData; } /* Render form */ } /* Check user input */ public function checkformAction() { // Get POST data $request = $this-getRequest(); $post = $request-getPost(); /* Validation logic */ /* If errors, go back to view */ // Pass error message... $this-view-formData = $post; // Redirect /* If input ok */ $formSession = new Zend_Session_Namespace('form'); $formSession-formData = serialize($post); // Go to previewAction, e.g. } Hi All I have developed a form using zend framework.When i click on submit button and id if due to validation some error message is displayed , at that time the values entered in text box will not be retained. Is their any way to retain these values using zend functionality Regard, Rohit83 -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
[fw-general] Layout with frames
Hello everyone, I have the following problem: We have a simple ZF-site with a simple layout (header, body, footer). Now, I need to introduce frames. The current site will be loaded in the main frame. A second frame contains some elements (e.g. embedded sound) that shouldn't be reloaded. Can someone give me a hint about how this could be done using ZF? Thank you! Best regards, Ivan. -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
[fw-general] Zend_Db_Table_Row: underscore_words to camelCaps conversion
Hello, From the manual (http://framework.zend.com/manual/en/zend.db.table.row.html): Next, retrieve one record from the database using Zend_Db_Table::find() with a single key, or by using Zend_Db_Table::fetchRow(). The returned result will be a Zend_Db_Table_Row object where each property in the object is a camelCaps name mapped to an underscore_words column name from the table. E.g., first_name in the table will become firstName in the object properties This is also the behavior I expected. Now I am using ZF 0.9.1, but I am a very happy user of ZF since 0.1.0. I have a simple load method. Surprisingly, the conversion between underscore_words (table field folder_id) and camelCaps (object attribute folderId) does not happen, i.e. the Zend_Db_Table_Row object has a property folder_id, but not folderId. Is the former behavior now something that has to be explicitly configured? Or is this former behavior simply not present in ZF 0.9.1? Thank you very much. Best regards, Ivan. -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
Re: [fw-general] ACL and Views
Hello Teemu, Have you already taken a look at the Simon Mundy's tutorial? I think you may find an answer to your question there. You'll find it under: http://www.zftutorials.com/zend-acl/ Cheers, Ivan. Teemu Välimäki schrieb: Hi, I'm not quite sure how I should use ACL with Views. I have a menu where I'd like items not to be visible if users role(s) have no access to it. So I was planning on doing array of the menu items and passing that to the view or passing the whole ACL object to view. Views should not contain logic so I'd be very glad to see a short example or explanation how to do this, to prevent wrong implementation. Virtual cookie for the one helping me out :) -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
[fw-general] A single Controller for all requests
Hello, This is my very simple question: I would like to route URL's like http://www.example.org/mainnavi/subnavi; to a single controller that renders the appropriate content depending on mainnavi and subnavi. I would like to avoid writing one controller for each main navigation point. Which is the appropriate way to do this within Zend Framework? Or do you think that the whole approach is unappropriate? Thank you. Regards, Ivan.