#6521: Form helper produces incorrect element names for DB fields whose names 
are
the same as the inflected model name
---------------------------------+------------------------------------------
    Reporter:  cheleball         |          Type:  Bug    
      Status:  new               |      Priority:  Medium 
   Milestone:  1.2.x.x           |     Component:  Helpers
     Version:  1.2 Final         |      Severity:  Normal 
    Keywords:  form helper name  |   Php_version:  PHP 5  
Cake_version:                    |  
---------------------------------+------------------------------------------
 I have a table with the following schema:
 {{{
 CREATE TABLE `sections` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `course_id` int(10) unsigned default NULL,
   `instructor_id` int(10) unsigned default NULL,
   `section` varchar(10) NOT NULL default '1',
   PRIMARY KEY  (`id`),
   KEY `instructor_id` (`instructor_id`),
   KEY `course_id` (`course_id`)
 ) ENGINE=MyISAM AUTO_INCREMENT=5518 DEFAULT CHARSET=latin1
 }}}

 This table "has many" courses. The structure of the courses table is
 probably not related to this issue.

 In my courses/add view, I have the following line:
 {{{
 echo $form->text('Section.section', array('maxlength'=>'10'));
 }}}

 Which produces the following HTML output:
 {{{
 <input name="data[Section][Section][section]" type="text" maxlength="10"
 value="" id="SectionSectionSection" />
 }}}

 Note the double repetition of 'Section' in the name attribute (and triple
 repetition in the id attribute). I would expect the name to be
 data[Section][section].

 I do not know the root cause of this issue, but I do know that it has only
 happened when the field in question has the same name as the inflected
 model name, as it does in this example.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6521>
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
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to