Description

This is just an idea, so I'm not proposing any code yet until you consider it valuable :-) I think it would be useful to be able to pass an array as the $value argument to any form helper because it will automate the process to generate universal forms for adding/editing records e.g

This code would generate a blank field if $post is null or insert the $post['first_name'] value if it's available. It's a common practice (at least for me) to have the same xhtml form for adding and editing certain records. Therefore, the ability to pass an array as $value, which then would lookup the element that matches $name, would definitely simplify creation of such forms. Please let me know what you think about this and I'll write the code if you agree :-)

Comments

Posted by Dawid Zamirski (maners) on 2007-06-11T10:45:58.000+0000

Attached is a patch against SVN trunk which enables $value argument to be an array from which it attempts to extract data for the value XHTML attribute. The $value array must contain a key matching $name and, if it does not, blank ('') value is used instead. This patch doesn't change behavior of existing API and it just adds the new functionality. I have used it for a few weeks with one of my projects and it didn't cause any problems.