#6269: Field labels and titles defined in the model --------------------------+------------------------------------------------- Reporter: jaime | Type: RFC Status: new | Priority: Medium Milestone: 1.2.x.x | Component: Model Version: 1.2 Final | Severity: Normal Keywords: | Php_version: n/a Cake_version: | --------------------------+------------------------------------------------- Almost every field in a form needs a matching '''<label>''' tag and many times a hint to the user presented in the form of tooltips via the '''"title"''' attribute. That makes the following a pretty common structure which is repeated in almost every edit/create views:
{{{ echo $form->input('login', array('label' => 'Your login', 'title' => 'No spaces; only alphanumeric characters')); echo $form->input('name', array('label' => 'Full name', 'title' => 'Your full name as it will be published in the site')); echo $form->input('password', array('label' => 'Password', 'title' => 'At least 6 characters')); }}} That could be reduced to: {{{ echo $form->input('login'); echo $form->input('name'); echo $form->input('password'); }}} Or even just: {{{ echo $form->inputs(); }}} '''If the "title", "tag" and possibly "after" and "before" attributes could be defined in the model''', pretty much like the validation error messages are currently defined. To my point of view, the label of a field or it's hint (tooltip), are not presentational only, and could be considered as part of the data model. Benefits: * Lighter views. * Better documented models. * Less redundance over views. Caveats: * Internationalization. Related: http://groups.google.com/group/cake- php/browse_thread/thread/85f654eda95fafe2 -- Ticket URL: <https://trac.cakephp.org/ticket/6269> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to tickets-cakephp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---