Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
Thanks man. Appreciate your answer so long after the thread was started. Ryan Lange wrote: This is an old thread, but I noticed that no one actually hit upon the *real* problem. On Mon, Feb 16, 2009 at 7:28 AM, bytte thomas.bytteb...@gmail.com wrote: Bug in my code or bug in Zend Framework? Neither. It's an unfortunate short-coming of PHP itself. http://us3.php.net/manual/en/ini.core.php#ini.post-max-size : If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. Files are uploaded as post data. If the file being uploaded pushes the post data beyond the size allowed in php.ini, you get empty $_POST and $_FILES superglobals, which is why ZF complains about not being able to find your file field. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p25869083.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Keep me logged in + Password reset for login forms
I've created a basic login system using Zend_Auth and Zend_Acl and now I'm wondering what's the best way to expand my login form with these two extra functionalities: - keep me logged in on this computer feature - password reset if visitor has forgotten password These two things seem pretty standard in every web application that needs authentication so I had hoped to see these built in into the framework. Yet I can't find any documentation on this matter. It would be great if you could point me in a direction or link to online tuts tackling the matter. -- View this message in context: http://www.nabble.com/Keep-me-logged-in-%2B-Password-reset-for-login-forms-tp23631798p23631798.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Calling exter nal autoload function – how to?
Thanks so much Matthew. For the record and the people that use Nabble to find information about this topic: this is the code used that works: function My_DOMPDF_Autoload($class) { $filename = include . '/' . mb_strtolower($class) . '.cls.php'; if (Zend_Loader::isReadable($filename)) { return include_once $filename; } return false; } require_once Zend/Loader.php; spl_autoload_register('My_DOMPDF_Autoload'); Zend_Loader::registerAutoload(); Matthew Weier O'Phinney-3 wrote: -- bytte thomas.bytteb...@gmail.com wrote (on Friday, 10 April 2009, 03:40 PM -0700): But then I get these errors everywhere: Warning: require_once(/Users/xxx/Sites/zf-test/library/dompdf-0.5.1/include/zend_config_ini.cls.php) [function.require-once]: failed to open stream: No such file or directory in /Users/xxx/Sites/zf-test/library/dompdf-0.5.1/dompdf_config.inc.php on line 194 And Fatal error: require_once() [function.require]: Failed opening required '/Users/xxx/Sites/zf-test/library/dompdf-0.5.1/include/zend_config_ini.cls.php' (include_path='.:../library/:../application/models:../application/forms:../library/dompdf-0.5.1:.:/opt/local/lib/php') in /Users/xxx/Sites/zf-test/library/dompdf-0.5.1/dompdf_config.inc.php on line 194 What am I doing wrong? Well, *you* aren't -- the authors of DOMPDF are by using require_once in their autoloader (that's a no-no; autoloaders should be chainable, and thus fail gracefully). Create your own autoloader function for their stuff that's a bit less restrictive. For example, try the following in your bootstrap: function My_DOMPDF_Autoload($class) { $filename = DOMPDF_INC_DIR . '/' . mb_strtolower($class) . '.cls.php'; if (Zend_Loader::isReadable($filename)) { return include_once $filename; } return false; } require_once 'Zend/Loader.php'; spl_register_autoload('My_DOMPDF_Autoload'); Zend_Loader::registerAutoload(); and that should work. Matthew Weier O'Phinney-3 wrote: -- bytte thomas.bytteb...@gmail.com wrote (on Friday, 10 April 2009, 09:28 AM -0700): Thanks. But I'm confused. Early on in my bootstrap I have this code: set_include_path('.' . PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . '../application/models' . PATH_SEPARATOR . '../application/forms' . PATH_SEPARATOR . '../library/dompdf-0.5.1' . PATH_SEPARATOR . get_include_path()); include Zend/Loader.php; Zend_Loader::registerAutoload(); Then where exactly do I need to insert this spl_autoload_register() function? Before the Zend_Loader::registerAutoload() call. If I do it in my controller where I create the pdf, the pdf gets created but it starts with a lot of warnings because a lot of files in the DOMPDF file structure weren't found. Such as: Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Style.php' for inclusion (include_path='.:../library/:../application/models:../application/forms:../library/dompdf-0.5.1:.:/opt/local/lib/php') in /Users/xxx/Sites/zf-test/library/Zend/Loader.php on line 83 If I do it in my bootstrap just before Zend_Loader::registerAutoload(), all my other code doesn't work anymore as it looks like the DOMPDF autoloader is used to load all the ZF classes. Here's the warnings I get then: Warning: require_once(/Users/xxx/Sites/zf-test/library/dompdf-0.5.1/include/zend_config_ini.cls.php) [function.require-once]: failed to open stream: No such file or directory in /Users/xxx/Sites/zf-test/library/dompdf-0.5.1/dompdf_config.inc.php on line 194 Could you provide me with some more information? It would be really helpful. Mon Zafra wrote: spl_autoload_register('DOMPDF_autoload'); Make sure that loader is registered late in the stack because it does a require_once, meaning it will throw a fatal if it fails and will prevent the other autoloaders from trying to load the class. -- Mon On Fri, Apr 10, 2009 at 9:22 PM, bytte thomas.bytteb...@gmail.com wrote: I'm using DOMPDF in a project of mine and I was wondering how I can call DOMPDF's autoload function so it can function together with the one from Zend Framework. Here's what DOMPDF says: /** * DOMPDF autoload function * * If you have an existing autoload function, add a call to this function * from your existing __autoload() implementation. * * @param string $class */ function DOMPDF_autoload($class) { $filename = mb_strtolower($class) . .cls.php; require_once(DOMPDF_INC_DIR . /$filename); } How exactly can I make it work together with the ZF? -- View this message in context: http://www.nabble.com/Calling-external-autoload-function-%E2%80%93-how-to--tp22987919p22987919.html Sent from the Zend
[fw-general] Calling externa l autoload function – how to?
I'm using DOMPDF in a project of mine and I was wondering how I can call DOMPDF's autoload function so it can function together with the one from Zend Framework. Here's what DOMPDF says: /** * DOMPDF autoload function * * If you have an existing autoload function, add a call to this function * from your existing __autoload() implementation. * * @param string $class */ function DOMPDF_autoload($class) { $filename = mb_strtolower($class) . .cls.php; require_once(DOMPDF_INC_DIR . /$filename); } How exactly can I make it work together with the ZF? -- View this message in context: http://www.nabble.com/Calling-external-autoload-function-%E2%80%93-how-to--tp22987919p22987919.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Calling exter nal autoload function – how to?
Thanks. But I'm confused. Early on in my bootstrap I have this code: set_include_path('.' . PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . '../application/models' . PATH_SEPARATOR . '../application/forms' . PATH_SEPARATOR . '../library/dompdf-0.5.1' . PATH_SEPARATOR . get_include_path()); include Zend/Loader.php; Zend_Loader::registerAutoload(); Then where exactly do I need to insert this spl_autoload_register() function? If I do it in my controller where I create the pdf, the pdf gets created but it starts with a lot of warnings because a lot of files in the DOMPDF file structure weren't found. Such as: Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Style.php' for inclusion (include_path='.:../library/:../application/models:../application/forms:../library/dompdf-0.5.1:.:/opt/local/lib/php') in /Users/xxx/Sites/zf-test/library/Zend/Loader.php on line 83 If I do it in my bootstrap just before Zend_Loader::registerAutoload(), all my other code doesn't work anymore as it looks like the DOMPDF autoloader is used to load all the ZF classes. Here's the warnings I get then: Warning: require_once(/Users/xxx/Sites/zf-test/library/dompdf-0.5.1/include/zend_config_ini.cls.php) [function.require-once]: failed to open stream: No such file or directory in /Users/xxx/Sites/zf-test/library/dompdf-0.5.1/dompdf_config.inc.php on line 194 Could you provide me with some more information? It would be really helpful. Mon Zafra wrote: spl_autoload_register('DOMPDF_autoload'); Make sure that loader is registered late in the stack because it does a require_once, meaning it will throw a fatal if it fails and will prevent the other autoloaders from trying to load the class. -- Mon On Fri, Apr 10, 2009 at 9:22 PM, bytte thomas.bytteb...@gmail.com wrote: I'm using DOMPDF in a project of mine and I was wondering how I can call DOMPDF's autoload function so it can function together with the one from Zend Framework. Here's what DOMPDF says: /** * DOMPDF autoload function * * If you have an existing autoload function, add a call to this function * from your existing __autoload() implementation. * * @param string $class */ function DOMPDF_autoload($class) { $filename = mb_strtolower($class) . .cls.php; require_once(DOMPDF_INC_DIR . /$filename); } How exactly can I make it work together with the ZF? -- View this message in context: http://www.nabble.com/Calling-external-autoload-function-%E2%80%93-how-to--tp22987919p22987919.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Calling-external-autoload-function-%E2%80%93-how-to--tp22987919p22990711.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Calling exter nal autoload function – how to?
But then I get these errors everywhere: Warning: require_once(/Users/xxx/Sites/zf-test/library/dompdf-0.5.1/include/zend_config_ini.cls.php) [function.require-once]: failed to open stream: No such file or directory in /Users/xxx/Sites/zf-test/library/dompdf-0.5.1/dompdf_config.inc.php on line 194 And Fatal error: require_once() [function.require]: Failed opening required '/Users/xxx/Sites/zf-test/library/dompdf-0.5.1/include/zend_config_ini.cls.php' (include_path='.:../library/:../application/models:../application/forms:../library/dompdf-0.5.1:.:/opt/local/lib/php') in /Users/xxx/Sites/zf-test/library/dompdf-0.5.1/dompdf_config.inc.php on line 194 What am I doing wrong? Matthew Weier O'Phinney-3 wrote: -- bytte thomas.bytteb...@gmail.com wrote (on Friday, 10 April 2009, 09:28 AM -0700): Thanks. But I'm confused. Early on in my bootstrap I have this code: set_include_path('.' . PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . '../application/models' . PATH_SEPARATOR . '../application/forms' . PATH_SEPARATOR . '../library/dompdf-0.5.1' . PATH_SEPARATOR . get_include_path()); include Zend/Loader.php; Zend_Loader::registerAutoload(); Then where exactly do I need to insert this spl_autoload_register() function? Before the Zend_Loader::registerAutoload() call. If I do it in my controller where I create the pdf, the pdf gets created but it starts with a lot of warnings because a lot of files in the DOMPDF file structure weren't found. Such as: Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Style.php' for inclusion (include_path='.:../library/:../application/models:../application/forms:../library/dompdf-0.5.1:.:/opt/local/lib/php') in /Users/xxx/Sites/zf-test/library/Zend/Loader.php on line 83 If I do it in my bootstrap just before Zend_Loader::registerAutoload(), all my other code doesn't work anymore as it looks like the DOMPDF autoloader is used to load all the ZF classes. Here's the warnings I get then: Warning: require_once(/Users/xxx/Sites/zf-test/library/dompdf-0.5.1/include/zend_config_ini.cls.php) [function.require-once]: failed to open stream: No such file or directory in /Users/xxx/Sites/zf-test/library/dompdf-0.5.1/dompdf_config.inc.php on line 194 Could you provide me with some more information? It would be really helpful. Mon Zafra wrote: spl_autoload_register('DOMPDF_autoload'); Make sure that loader is registered late in the stack because it does a require_once, meaning it will throw a fatal if it fails and will prevent the other autoloaders from trying to load the class. -- Mon On Fri, Apr 10, 2009 at 9:22 PM, bytte thomas.bytteb...@gmail.com wrote: I'm using DOMPDF in a project of mine and I was wondering how I can call DOMPDF's autoload function so it can function together with the one from Zend Framework. Here's what DOMPDF says: /** * DOMPDF autoload function * * If you have an existing autoload function, add a call to this function * from your existing __autoload() implementation. * * @param string $class */ function DOMPDF_autoload($class) { $filename = mb_strtolower($class) . .cls.php; require_once(DOMPDF_INC_DIR . /$filename); } How exactly can I make it work together with the ZF? -- View this message in context: http://www.nabble.com/Calling-external-autoload-function-%E2%80%93-how-to--tp22987919p22987919.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Calling-external-autoload-function-%E2%80%93-how-to--tp22987919p22990711.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | matt...@zend.com Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Calling-external-autoload-function-%E2%80%93-how-to--tp22987919p22995726.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Best coding practice? Form takes too long to load now.
It would be great if you could share me some more details. Maybe point me in the right direction on how to share those PluginLoader objects between each element? Too bad I'm on a tight schedule (should be finished by the end of the week). If I don't hear back from the list I'll most likely take an Ajax approach: only loading form elements through javascript when the users needs them. But I'm not looking forward to that to be honest. Matthew Weier O'Phinney-3 wrote: I've worked with another user on a similar issue before. The solution we came up with was to share the PluginLoader objects between each element (by default, there are plugin loaders for each element). I'll see if I can get some more details worked up to share. -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22562600.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Best coding practice? Form takes too long to load now.
Hi guys Thanks to your help I managed to load the page in only 15 queries whereas before I needed more than 1000 queries. That's great. However my page load problem hasn't been solved. I've installed xdebug and it lists this information: ( ! ) Fatal error: Maximum execution time of 30 seconds exceeded in /../library/Zend/Form.php on line 2691 Call Stack # TimeMemory FunctionLocation 1 0.0019 76164 {main}( ) ../index.php:0 2 0.0789 3386952 Zend_Controller_Front-dispatch( ) ../index.php:83 3 0.2307 4511976 Zend_Controller_Dispatcher_Standard-dispatch( ) ../Front.php:934 4 0.2677 5380956 Zend_Controller_Action-dispatch( ) ../Standard.php:285 5 19.1972 37326484 Zend_Controller_Action_HelperBroker-notifyPostDispatch( ) ../Action.php:513 6 19.1974 37326900 Zend_Controller_Action_Helper_ViewRenderer-postDispatch( ) ../HelperBroker.php:276 7 19.1976 37326916 Zend_Controller_Action_Helper_ViewRenderer-render( ) ../ViewRenderer.php:962 8 19.2002 37328376 Zend_Controller_Action_Helper_ViewRenderer-renderScript( ) ../ViewRenderer.php:923 9 19.2003 37328772Zend_View_Abstract-render( ) ../ViewRenderer.php:902 10 19.2004 37370344Zend_View-_run( ) ../Abstract.php:820 11 19.2007 37373764include( './application/views/scripts/inspecties/add.phtml' )../View.php:107 12 19.2009 37374412Zend_Form-__toString( )../Form.php:0 13 19.2009 37374724Zend_Form-render( )../Form.php:2610 14 19.2010 37375352Zend_Form_Decorator_FormElements-render( ) ../Form.php:2595 15 34.7189 43742180Zend_Form-render( )../FormElements.php:100 16 34.7204 43744312Zend_Form_Decorator_FormElements-render( ) ../Form.php:2595 17 34.7224 43747512Zend_Form-render( )../FormElements.php:100 18 34.7237 43750168Zend_Form_Decorator_FormElements-render( ) ../Form.php:2595 19 36.2344 44322728Zend_Form-render( )../FormElements.php:100 20 36.2354 44323920Zend_Form_Decorator_FormElements-render( ) ../Form.php:2595 21 36.2355 44325948Zend_Form-getTranslator( ) ../FormElements.php:80 22 36.2355 44326112Zend_Form::getDefaultTranslator( ) ../Form.php:2677 I guess the problem lies in the form rendering. It makes sense as my page loads a lot of form elements through a foreach() loop. I'm starting to feel desperate. Anyone has any tips for me? -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22540146.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Best coding practice? Form takes too long to load now.
Thanks Christoph for your insightful reply. You're right. I'm using 4 nested for each loops with a few select queries in each loop. I will try to make a join query and then loop through the returned result array. As I understand from your reply that should make the page load faster and put a lot less load on the mysql server. ChristophDorn wrote: bytte wrote: Hey that was interesting. I have the indexes defined and I see though Firebug that there's currently 381 queries being performed at 0.14949 seconds. I guess that means they're not the culprit? 381 DB queries is a lot of queries for a single web page. Even if they only take 0.15 seconds combined, they will bring your DB server to it's knees as soon as you start putting some traffic through that page and other pages using the same DB. You are likely running DB queries in a loop which is not good practice. You should be using the IN SQL clause or use joins. It is much faster to add some more loops to your PHP than to run DB queries. If this page is going to be run a lot I would even check if you need to fetch the data from the DB on every page request or if you can cache some semi-static data. -- Christoph Dorn http://www.ChristophDorn.com/ http://www.ChristophDorn.com/ -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22413665.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Cache simple practice question
I'm working on an application that mostly reads data from the database and occasionally writes data to the database. I'm considering implementing Zend_Cache to cache database queries but was struggling with the question how long the queries should be cached. That's why I thought it may be best to store all select() queries in the cache forever. Then whenever there's an update to a database table delete the cached queries that belong to that table. Would that be a good setup? -- View this message in context: http://www.nabble.com/Zend_Cache-simple-practice-question-tp22352763p22352763.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Cache simple practice question
So you wouldn't recommend it? Giorgio Sironi wrote: 2009/3/5 bytte thomas.bytteb...@gmail.com That's why I thought it may be best to store all select() queries in the cache forever. Then whenever there's an update to a database table delete the cached queries that belong to that table. That's what MySql does - caching select queries that are invalidated when the table changes. -- Giorgio Sironi Piccolo Principe Ossigeno Scripter http://ossigeno.sourceforge.net -- View this message in context: http://www.nabble.com/Zend_Cache-simple-practice-question-tp22352763p22355452.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Best coding practice? Form takes too long to load now.
Hey that was interesting. I have the indexes defined and I see though Firebug that there's currently 381 queries being performed at 0.14949 seconds. I guess that means they're not the culprit? Are there any other tools to help me find out what code makes the script run so slow? Any help would be greatly appreciated. Thomas B. swilhelm wrote: Try running the Firebug profiler, Zend_Db_Profiler_Firebug, to see if its the database queries are the culprit. I assume you already have indices defined for the playground_id and device_id columns. Might be time to switch to a data table like display (e.g. YUI DataTable) containing a list of all devices with one of the columns being a link to an device edit form which can simply be a separate page or with a bit more work dynamically displayed and populated using AJAX. Populating the data table could then be done with a single select call that does a join across playgrounds and checkpoints. - Steve W. -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22329848.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Best coding practice? Form takes too long to load now.
I'm not. I'll look into that. keith Pope-4 wrote: Are you using the meta-data cache? -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22331385.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Best coding practice? Form takes too long to load now.
I have a form class that creates form elements based on database information. The problem is that the form takes more than 20 seconds to load on my localhost. On the web server it's even worse: the form doesn't load at all because of limited memory resources. I was hoping you guys could give me some tips on optimizing my form setup. The web application I'm working on is an online park administration tool for a company that repairs playground equipment for its clients. Every few months the company needs to check the status of the playground equipment. They can do that by filling in the form that loads form fields based on a few predefined checkpoints. Eg. Is there still enough sand in the area around the playground device? etc. I have a database with a clients table, a playgrounds table, a equipment table and a checkpoints table. Every client owns a few playgrounds. Every playground consists of some devices (equipment). And every device has a few checkpoints that need to be checked. Basically the form displays input fields for every checkpoint for every device for every playground of that particular client. Currently I query the playgrounds table to find all playgrounds the logged in client owns. Then for every playground I display a subform. In the subform I have another subform for every playground device. Then I query the database to find the checkpoints for every device. Based on those checkpoints the form displays some form fields in the devices subform. Of course I use a lot of foreach() loops to be able to display all necessary form fields. foreach($playgrounds as $playground) { $devices = $playgrounds-fetchAll($playgrounds-select()-where('playground_id = ?',$playground-id); foreach($devices as $device) { $checkpoints = $checkpoints-fetchAll($checkpoints-select()-where('device_id = ?',$device-id); foreach($checkpoints as $checkpoint) { //create form fields } } } I found that if there's less checkpoints the form loads way quicker. I was wondering if there's a better way of coding in order to have the form load faster. -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22309252.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
Thanks Thomas. I downloaded the trunk code today and now the script finds out that a file was submitted with a size bigger than what's allowed in php.ini. So that's great now. However, I found out the upload script is now only working about 50% of the times I tried it. I'll dive into my code once more to find out what's causing this. thomasW wrote: You have 3 possible solutions: 1) Use trunk release 2) Wait for the next minor release which will be 1.8 3) Make a workaround yourself by looking at the trunk code and integrate it into your application To note: This is a PHP only problem due to the fact that PHP provides an empty $_FILES array when the post_max_* setting was exceeded by the form. You can also find other solutions which you could integrate manually by looking at the PHP manual. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p2226.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
Is anyone else having similar problems? I've spend a few hours on this issue already and couldn't come up with a decent solution. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p22206576.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
Hmm... you seem to be right. It looks as if there's no file submitted. This is what is in the $_FILES array on a successful file upload (file less than php.ini's max file-size): Array ( [file1] = Array ( [name] = testfile.pdf [type] = application/pdf [tmp_name] = /private/var/tmp/phpPuRUtw [error] = 0 [size] = 112947 ) ) If I upload a file larger than what's definined in php.ini the array is empty. The print_r function just outputs: Array() thomasW wrote: That's correct. MAX_FILE_SIZE is a hidden form field. It would be interesting to see what your server saves as data to the $_FILES array. Normally there should be an error (3 or 4) but it seems that in your case there is no file submitted in this case. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: bytte thomas.bytteb...@gmail.com To: fw-general@lists.zend.com Sent: Wednesday, February 18, 2009 1:03 AM Subject: Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught? It's really weird. Since I'm using the code from the svn trunk it doesn't output the MAX_FILE_SIZE in the html code no more. It does show it in the first form on the same page. All my error messages display fine. But still no error message when the user uploads a file bigger than what's allowed in php.ini Here the code in my controller: public function editAction() { $toestellen = new Toestellen(); //fetch het toestel met deze id $row = $toestellen-fetchRow('id=' . $this-id); $this-view-toestel = $row; $this-view-title = 'Wijzig ' . $row-naam; if($row-type == 2) { $form = new OmgevingForm(); } else { $form = new ToestelForm(); } $form-submit-setLabel('Wijzig'); $form-submit-setDescription('of ' . $this- view-baseUrl() . '/speelpleinen/toestel/id/' . $this-id . '/speelplein/'.$this-speelpleinId . 'Annuleer '); $this-view-form = $form; //maak bestandenform $bestandenForm = new BestandenForm(); $this-view-bestandenForm = $bestandenForm; //toon gekoppelde bestanden $bestanden = new Bestanden(); $bestandenLijst = $bestanden-fetchAll($bestanden-select()-where('ref_tabel = ?','toestellen')-where('ref_id = ?',$this-id)-order('created_dt ASC')); $this-view-bestandenLijst = $bestandenLijst; if($this-flash-hasMessages()) { $this-view-formResponse = implode(br /, $this-flash-getMessages()); } if($this-_request-isPost()) { $formData = $this-_request-getPost(); if(array_key_exists('pic1',$formData)) { //het gaat om het toestelform if($form-isValid($formData)) { if ($_FILES['pic1']['tmp_name']) { $formData['pic1'] = $_FILES['pic1']; } if($row-type == 2) { $omgevingen = new Omgevingen(); $omgevingen-editOmgeving($formData); } else { $toestellen-setFormData($formData); $toestellen-editItem(); } //update gelukt - gebruiker laten weten $this-flash-addMessage(De gegevens werden gewijzigd!); $this-_helper-redirector-gotoUrl('/speelpleinen/toestel/id/'.$this-id . '/speelplein/'.$this-speelpleinId); } else { $form-populate($formData); } } else { // het gaat om het bestandenform upload ding if($bestandenForm-isValid($formData)) { if ($_FILES['file1']['tmp_name']) { $formData['file1'] = $_FILES['file1']; } //doe iets er mee $bestanden = new Bestanden(); $uploaden = $bestanden-saveBestand($formData); //update gelukt - gebruiker laten weten if($uploaden) { $this-flash-addMessage(Het bestand werd toegevoegd.); } else { $this-flash-addMessage(Er was een fout. Probeer opnieuw.); } $this-_helper-redirector-gotoUrl('/toestellen/edit/id/'.$this-id . '/speelplein/'.$this-speelpleinId); } else { $bestandenForm-populate($formData); print_r($bestandenForm-getMessages()); $id = $this-id; if($id 0) { $toestel = $toestellen-fetchRow('id=' . $id); $form-populate($toestel-toArray()); } } } } else { $id = $this-id; if($id 0) { $toestel = $toestellen-fetchRow('id=' . $id); $form-populate($toestel-toArray()); } } } This is the code of the form (BestandenForm.php): class BestandenForm extends Zend_Form { protected $_front; public function setFrontController() { $this-_front = Zend_Controller_Front::getInstance(); } public function init() { $this-setFrontController(); $baseUrl = $this-_front-getRequest()-getBaseUrl(); //formulier aanmaken en basiszaken instellen $this-setName('bestanden') -setAttrib('id','bestanden') -setAttrib('class','bestanden') -setAttrib('enctype','multipart/form-data'); //er is mogelijke file-upload! //verborgen id veld $id = new Zend_Form_Element_Hidden('id'); $id-setValue($this-_front-getRequest()-getParam('id')); $this-addElement($id); //verborgen veldveld $sectie = new Zend_Form_Element_Hidden('sectie'); $sectie-setValue($this-_front-getRequest()-getControllerName()); $this-addElement($sectie); $this-setElementDecorators(array( 'ViewHelper', 'Errors', array
Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
It's really weird. Since I'm using the code from the svn trunk it doesn't output the MAX_FILE_SIZE in the html code no more. It does show it in the first form on the same page. All my error messages display fine. But still no error message when the user uploads a file bigger than what's allowed in php.ini Here the code in my controller: public function editAction() { $toestellen = new Toestellen(); //fetch het toestel met deze id $row = $toestellen-fetchRow('id=' . $this-id); $this-view-toestel = $row; $this-view-title = 'Wijzig ' . $row-naam; if($row-type == 2) { $form = new OmgevingForm(); } else { $form = new ToestelForm(); } $form-submit-setLabel('Wijzig'); $form-submit-setDescription('of ' . $this- view-baseUrl() . '/speelpleinen/toestel/id/' . $this-id . '/speelplein/'.$this-speelpleinId . 'Annuleer '); $this-view-form = $form; //maak bestandenform $bestandenForm = new BestandenForm(); $this-view-bestandenForm = $bestandenForm; //toon gekoppelde bestanden $bestanden = new Bestanden(); $bestandenLijst = $bestanden-fetchAll($bestanden-select()-where('ref_tabel = ?','toestellen')-where('ref_id = ?',$this-id)-order('created_dt ASC')); $this-view-bestandenLijst = $bestandenLijst; if($this-flash-hasMessages()) { $this-view-formResponse = implode(br /, $this-flash-getMessages()); } if($this-_request-isPost()) { $formData = $this-_request-getPost(); if(array_key_exists('pic1',$formData)) { //het gaat om het toestelform if($form-isValid($formData)) { if ($_FILES['pic1']['tmp_name']) { $formData['pic1'] = $_FILES['pic1']; } if($row-type == 2) { $omgevingen = new Omgevingen(); $omgevingen-editOmgeving($formData); } else { $toestellen-setFormData($formData); $toestellen-editItem(); } //update gelukt - gebruiker laten weten $this-flash-addMessage(De gegevens werden gewijzigd!); $this-_helper-redirector-gotoUrl('/speelpleinen/toestel/id/'.$this-id . '/speelplein/'.$this-speelpleinId); } else { $form-populate($formData); } } else { // het gaat om het bestandenform upload ding if($bestandenForm-isValid($formData)) { if ($_FILES['file1']['tmp_name']) { $formData['file1'] = $_FILES['file1']; } //doe iets er mee $bestanden = new Bestanden(); $uploaden = $bestanden-saveBestand($formData); //update gelukt - gebruiker laten weten if($uploaden) { $this-flash-addMessage(Het bestand werd toegevoegd.); } else { $this-flash-addMessage(Er was een fout. Probeer opnieuw.); } $this-_helper-redirector-gotoUrl('/toestellen/edit/id/'.$this-id . '/speelplein/'.$this-speelpleinId); } else { $bestandenForm-populate($formData); print_r($bestandenForm-getMessages()); $id = $this-id; if($id 0) { $toestel = $toestellen-fetchRow('id=' . $id); $form-populate($toestel-toArray()); } } } } else { $id = $this-id; if($id 0) {
Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
Bug in my code or bug in Zend Framework? bytte wrote: I'm now using setMaxFileSize(). Here's the (reduced for readability) code in my controller to retrieve and validate the form input. I have two forms on the same page so that's why I do the array_key_exists thing to check which form was submitted. Might not be the best way of doing things. file1 is the name of the upload file field. if($this-_request-isPost()) { $formData = $this-_request-getPost(); if(array_key_exists('file1',$formData)) { if($bestandenForm-isValid($formData)) { if ($_FILES['file1']['tmp_name']) { $formData['file1'] = $_FILES['file1']; } //do something with the file via upload class //then redirect user if successful } } else { //other form is submitted, validate and do something with it } } thomasW wrote: Use setMaxFileSize() instead of adding the field manually. Beside that it seems like you are doing something wrong when processing the files. How does your validation/retrievment code looks like ? This failure is thrown when you are trying to receive a non existant file for example. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: bytte thomas.bytteb...@gmail.com To: fw-general@lists.zend.com Sent: Tuesday, February 10, 2009 10:51 PM Subject: Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught? Thanks for the reply Thomas. I added this line to the form (via Zend_Form of course, but this is the html output): input id=MAX_FILES_SIZE type=hidden value=6291456 name=MAX_FILES_SIZE/ I'm using Zend Framework 1.7.4 (downloaded about a week ago). I have no experience with Subversion so I'm not sure how to download the svn trunk. thomasW wrote: Which release are you using ? Can you try svn trunk ? How did you add the MAX_FILES_SIZE ? Where did you add it ? Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: bytte thomas.bytteb...@gmail.com To: fw-general@lists.zend.com Sent: Tuesday, February 10, 2009 4:43 PM Subject: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught? I'm using Zend_File via Zend_Form_Element_File to let my web application's users upload files. I use the following Validators: $file1-setRequired(true) -addValidator('NotEmpty',true) -addValidator('Count',false,array('min' = 1, 'max' = 1)) -addValidator('MimeType', true, array('application/pdf')) -addValidator('Extension',false,array('pdf')) -addValidator('Size',false,array('max' = '6MB')); It works ok and the validators seem to do their job well but on one occasion: when the user tries to upload a file that's bigger than what's allowed in the server's php.ini file. That value is set to 10MB and when I upload a file of let's say 12MB I just get this error: Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with message 'file1 not found by file transfer adapter'. If the user tries to upload a file that's bigger than 6MB (as defined in the Size validator) but smaller than 10MB it's ok as a user-friendly message is shown to the user. Is there a way to display a user-friendly message to the user when he/she tries to upload a file bigger than what's allowed in php.ini? Now it just looks as if the application is broken. For the record: I have set html's MAX_FILES_SIZE to 6MB as well. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21936346.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21943430.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p22035588.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
I'm using Zend_File via Zend_Form_Element_File to let my web application's users upload files. I use the following Validators: $file1-setRequired(true) -addValidator('NotEmpty',true) -addValidator('Count',false,array('min' = 1, 'max' = 1)) -addValidator('MimeType', true, array('application/pdf')) -addValidator('Extension',false,array('pdf')) -addValidator('Size',false,array('max' = '6MB')); It works ok and the validators seem to do their job well but on one occasion: when the user tries to upload a file that's bigger than what's allowed in the server's php.ini file. That value is set to 10MB and when I upload a file of let's say 12MB I just get this error: Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with message 'file1 not found by file transfer adapter'. If the user tries to upload a file that's bigger than 6MB (as defined in the Size validator) but smaller than 10MB it's ok as a user-friendly message is shown to the user. Is there a way to display a user-friendly message to the user when he/she tries to upload a file bigger than what's allowed in php.ini? Now it just looks as if the application is broken. For the record: I have set html's MAX_FILES_SIZE to 6MB as well. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21936346.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
Thanks for the reply Thomas. I added this line to the form (via Zend_Form of course, but this is the html output): input id=MAX_FILES_SIZE type=hidden value=6291456 name=MAX_FILES_SIZE/ I'm using Zend Framework 1.7.4 (downloaded about a week ago). I have no experience with Subversion so I'm not sure how to download the svn trunk. thomasW wrote: Which release are you using ? Can you try svn trunk ? How did you add the MAX_FILES_SIZE ? Where did you add it ? Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: bytte thomas.bytteb...@gmail.com To: fw-general@lists.zend.com Sent: Tuesday, February 10, 2009 4:43 PM Subject: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught? I'm using Zend_File via Zend_Form_Element_File to let my web application's users upload files. I use the following Validators: $file1-setRequired(true) -addValidator('NotEmpty',true) -addValidator('Count',false,array('min' = 1, 'max' = 1)) -addValidator('MimeType', true, array('application/pdf')) -addValidator('Extension',false,array('pdf')) -addValidator('Size',false,array('max' = '6MB')); It works ok and the validators seem to do their job well but on one occasion: when the user tries to upload a file that's bigger than what's allowed in the server's php.ini file. That value is set to 10MB and when I upload a file of let's say 12MB I just get this error: Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with message 'file1 not found by file transfer adapter'. If the user tries to upload a file that's bigger than 6MB (as defined in the Size validator) but smaller than 10MB it's ok as a user-friendly message is shown to the user. Is there a way to display a user-friendly message to the user when he/she tries to upload a file bigger than what's allowed in php.ini? Now it just looks as if the application is broken. For the record: I have set html's MAX_FILES_SIZE to 6MB as well. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21936346.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21943430.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?
I'm now using setMaxFileSize(). Here's the (reduced for readability) code in my controller to retrieve and validate the form input. I have two forms on the same page so that's why I do the array_key_exists thing to check which form was submitted. Might not be the best way of doing things. file1 is the name of the upload file field. if($this-_request-isPost()) { $formData = $this-_request-getPost(); if(array_key_exists('file1',$formData)) { if($bestandenForm-isValid($formData)) { if ($_FILES['file1']['tmp_name']) { $formData['file1'] = $_FILES['file1']; } //do something with the file via upload class //then redirect user if successful } } else { //other form is submitted, validate and do something with it } } thomasW wrote: Use setMaxFileSize() instead of adding the field manually. Beside that it seems like you are doing something wrong when processing the files. How does your validation/retrievment code looks like ? This failure is thrown when you are trying to receive a non existant file for example. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: bytte thomas.bytteb...@gmail.com To: fw-general@lists.zend.com Sent: Tuesday, February 10, 2009 10:51 PM Subject: Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught? Thanks for the reply Thomas. I added this line to the form (via Zend_Form of course, but this is the html output): input id=MAX_FILES_SIZE type=hidden value=6291456 name=MAX_FILES_SIZE/ I'm using Zend Framework 1.7.4 (downloaded about a week ago). I have no experience with Subversion so I'm not sure how to download the svn trunk. thomasW wrote: Which release are you using ? Can you try svn trunk ? How did you add the MAX_FILES_SIZE ? Where did you add it ? Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: bytte thomas.bytteb...@gmail.com To: fw-general@lists.zend.com Sent: Tuesday, February 10, 2009 4:43 PM Subject: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught? I'm using Zend_File via Zend_Form_Element_File to let my web application's users upload files. I use the following Validators: $file1-setRequired(true) -addValidator('NotEmpty',true) -addValidator('Count',false,array('min' = 1, 'max' = 1)) -addValidator('MimeType', true, array('application/pdf')) -addValidator('Extension',false,array('pdf')) -addValidator('Size',false,array('max' = '6MB')); It works ok and the validators seem to do their job well but on one occasion: when the user tries to upload a file that's bigger than what's allowed in the server's php.ini file. That value is set to 10MB and when I upload a file of let's say 12MB I just get this error: Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with message 'file1 not found by file transfer adapter'. If the user tries to upload a file that's bigger than 6MB (as defined in the Size validator) but smaller than 10MB it's ok as a user-friendly message is shown to the user. Is there a way to display a user-friendly message to the user when he/she tries to upload a file bigger than what's allowed in php.ini? Now it just looks as if the application is broken. For the record: I have set html's MAX_FILES_SIZE to 6MB as well. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21936346.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21943430.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21944929.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] partialLoop() best practice
I use a partialLoop() to loop through query results in the view. So far so good. But for every item returned in the loop, I need to do another database query that returns another set of results that require a new partialLoop(). In the end I have a partialLoop() inside a partialLoop() inside a partialLoop(). But to be able to do the above, I have database queries and some php logic in the view inside every partialLoop() and that doesn't seem right if I want to follow the MVC principle. Is there a way to solve this? -- View this message in context: http://www.nabble.com/partialLoop%28%29-best-practice-tp21861311p21861311.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Re[fw-general] stricting display of links to non-authorized pages in view scripts- how to?
I was wondering if someone found/uses a better way of dealing with this problem yet? -- View this message in context: http://www.nabble.com/Restricting-display-of-links-to-non-authorized-pages-in-view-scripts--how-to--tp20273593p21545475.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re[fw-general] ndering pdf's with DomPDF and ZF
I'm using DOMPDF to create PDF files from the html that Zend Framework outputs. Here's my code: public function downloadAction() { $this-_helper-layout-setLayout('prints'); require_once(dompdf-0.5.1/dompdf_config.inc.php); spl_autoload_register('DOMPDF_autoload'); $dompdf = new DOMPDF(); $dompdf-set_paper(a4,landscape); $dompdf-load_html_file(http://localhost/test/httpdocs/inspecties/html;); $dompdf-render(); $dompdf-stream(sample.pdf); } I have two problems: 1. I seem to have to pass an absolute url to DomPDF's load_html_file() function. Is there a way to pass a relative url so I can make my application more portable? 2. I use Zend_Acl for access control. I have to make the requested html file publicly accessible for dompdf to be able to read the file contents. I'm not sure if this setup is recommended and secure as it means everyone pointing the browser to that url will be able to view html output that might not be inteded for their eyes. -- View this message in context: http://www.nabble.com/Rendering-pdf%27s-with-DomPDF-and-ZF-tp21374780p21374780.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Fatal error while trying to insert to db.
I'm trying to move more code from my controllers to my models. For an insert action I'm doing this: class Toestellen extends Zend_Db_Table_Abstract { (...) public function addItem() { $data = array( 'naam' = $this-_formData['naam'], 'nummer'= $this-_formData['nummer'], 'speelplein_id' = $this-_speelplein, 'created_dt'= date('Y-m-d H:i:s'), 'type' = $this-_type ); $this-insert($data); return $this-getLastInsertId(); } (...) } However I get this error: Fatal error: Call to a member function describeTable() on a non-object in /Users/bytte/Sites/speelokee-test/library/Zend/Db/Table/Abstract.php on line 696 Do you know what's wrong? -- View this message in context: http://www.nabble.com/Fatal-error-while-trying-to-insert-to-db.-tp20917866p20917866.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] How to: relative paths inside javascript files
Of course, thank you! Jason Webster wrote: I'd simply assign your baseUrl to a javascript variable. You could add this to the 'head' tag in your layout: script type=text/javascriptvar baseUrl = ?php echo $this-baseUrl() ?/script -- View this message in context: http://www.nabble.com/How-to%3A-relative-paths-inside-javascript-files-tp20443450p20445298.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re[fw-general] stricting display of links to non-authorized pages in view scripts- how to?
I managed to set up authentication through Zend_Auth and access control through Zend_Acl. This works without any problem. However, I'd like to take things one step further. My view scripts sometimes display links to pages that are not accessible by the logged in user, because that user does not have the proper rights to view that page. Think of an edit link next to a blog article. If only the author of the article is allowed (via Zend_Acl) to edit the article, then it makes no sense to display the edit link to other users as well, as clicking on the link will only send them to a not authorised page. Is there a convenient way of dealing with this problem? I'm sure it's a common request so I was hoping someone could help me with it. Thanks in advance. -- View this message in context: http://www.nabble.com/Restricting-display-of-links-to-non-authorized-pages-in-view-scripts--how-to--tp20273593p20273593.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Re[fw-general] stricting display of links to non-authorized pages in view scripts- how to?
Thanks Martin, That's what I did so far, but I'm not happy with all those 'if/else' clauses in my view script. I was hoping for a better way. Chris Martin wrote: You could make a view helper. -- View this message in context: http://www.nabble.com/Restricting-display-of-links-to-non-authorized-pages-in-view-scripts--how-to--tp20273593p20274602.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Re[fw-general] stricting display of links to non-authorized pages in view scripts- how to?
Thanks nwhiting, but links and such are view information, right? So don't they belong in the view? Think of an image linking to an edit page... nwhiting wrote: Pass the edit link based on the Acl level to the view instead of trying to do it in the view :) -- View this message in context: http://www.nabble.com/Restricting-display-of-links-to-non-authorized-pages-in-view-scripts--how-to--tp20273593p20274623.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Form validation messages are shown before submit
I managed to create a quite complex form. I had to play around with decorators and I guess this is where it went wrong. The form displays nice but on page load the validation messages are shown even though the user hasn't submitted anything yet! The form is not even filled in yet. What's worse is that after a form submit the validation messages are gone (even when they should be there). The world upside down. Do you know what has gone wrong? -- View this message in context: http://www.nabble.com/Zend_Form-validation-messages-are-shown-before-submit-tp20252211p20252211.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Form validation messages are shown before submit
Thanks a lot. Saved me a headache! bytte wrote: I managed to create a quite complex form. I had to play around with decorators and I guess this is where it went wrong. The form displays nice but on page load the validation messages are shown even though the user hasn't submitted anything yet! The form is not even filled in yet. What's worse is that after a form submit the validation messages are gone (even when they should be there). The world upside down. Do you know what has gone wrong? -- View this message in context: http://www.nabble.com/Zend_Form-validation-messages-are-shown-before-submit-tp20252211p20255323.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Image upload, validation and manipulation
I'm about to start implementing image uploads in my Zend Framework project. I've tried to work with image uploads a few months ago and it appeared to be not that straightforward at that time. The ZF documentation wasn't sufficient either. I was wondering if anyone here has links to good tutorials about uploading, manipulating and validating images with the Zend Framework. Any help appreciated. -- View this message in context: http://www.nabble.com/Image-upload%2C-validation-and-manipulation-tp20211804p20211804.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Populating, validating form elements with array notation
I'm using Zend_Form to build a form with array notation like this: (...) input name=text[] type=text input name=text[] type=text (...) The reason for this array notation is that I want to be able to dynamically add input elements to the dom through javascript. I can read the input values through $_POST['text'][0], $_POST['text'][1] and so on. This works great. Now my question is twofold: 1. How can I populate the form (for an edit action). Can I do this? $pop['text'][0] = value0; $pop['text'][1] = value1; $form-populate($pop); 2. What's the best way to validate the input elements I've added to the dom via javascript. Is there an easy way? -- View this message in context: http://www.nabble.com/Populating%2C-validating-form-elements-with-array-notation-tp20219845p20219845.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Image upload, validation and manipulation
Thanks! Additionally: if anyone is in the know of any good tutorials on the net that could come in handy on this topic, feel free to post them here. -- View this message in context: http://www.nabble.com/Image-upload%2C-validation-and-manipulation-tp20211804p20219873.html Sent from the Zend Framework mailing list archive at Nabble.com.