Wednesday, January 6, 2010

RE: Add Fields

Yeah I could do that but the average user will not have more than 3 or 4 and
honestly its more of a pain to add new, add new, add new 3 or 4 times for
the user. This way its all done on 1 page in 1 shot.

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of scs
Sent: January-06-10 4:02 PM
To: CakePHP
Subject: Re: Add Fields

The way I would handle this is to add a new table (1->Many) this way you can
allow the user to enter as many fields they want.
example:
CREATE TABLE profile_addons (
id int(10) unsigned NOT NULL auto_increment,
profile_id int(11) unsigned NOT NULL,
name varchar(75) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 ;


On Jan 6, 1:34 pm, "Dave" <make.cake.b...@gmail.com> wrote:
> What would be the easiest way to add say 10 input fields to a form
> that hasMany?
>
> I am allowing a user to add additional info to a profile and want to
> have 10 empty fields where they can type in whatever they want.
>
> I can manually make a form with 10 input fields but would like to know
> a simplified approach.
>
> Working with the idea of a foreach and build the fields but cant seem
> to get the idea of how to loop thru when there is nothing to loop ):
>
> $count++
> if $count > 10 type idea
>
> Ideas to point me in the right direction would be great.
>
> Thanks
>
> Dave

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.725 / Virus Database: 270.14.124/2599 - Release Date: 01/06/10
04:05:00

No comments: