News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jonathan Snook's Blog:
CakePHP Setting Default Values
June 28, 2006 @ 05:42:33

Jonathan Snook is back today with more information gleaned from his voyages into the world of the CakePHP framework, this time focusing on setting up default values in your script.

If you've got a user seeing a form for the first time, normally the fields are blank. But there are times where you want to prefill fields with data or preselect a certain option. Setting a default value turned out to be really straightforward.

He includes the code to make this "really straightforward" functionality happen. It's a simple seven line affair to make the value for the Project's name set to "Default Project Name". It uses the special "data" variable to push the value into, which, as he mentions later, is best set with a "$this->data" format as is in his example.

0 comments voice your opinion now!
cakephp framework set default values data controller cakephp framework set default values data controller


blog comments powered by Disqus

Similar Posts

Francois Zeninotto's Blog: Comparing Propel, Doctrine and sfPropelFinder

Paul Jones\' Blog: Instant Forms from Tables with Solar

Roy Ganor-Shwaartz's Blog: PDT Gets Smarty

Karsten Deubert's Blog: Zend_MVC, Controller Plugins and Annotations

PHPMaster.com: Openbiz Cubi: A Robust PHP Application Framework, Part 2


Community Events

Don't see your event here?
Let us know!


opinion interview xdebug framework php7 series install laravel5 podcast community api library release language unittest laravel extension voicesoftheelephpant example introduction

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework