Wednesday, January 6, 2010

RE: Add Fields

It is a separate Additional table with relations to
user hasMany Additional,
Additional belongsTo User

The problem with SCS idea is this is all in 1 form. Does not make sense in
my situation where a user is editing thier profile in 1 form to send them to
another form to edit 1 field, and if they have more than 1 additional to go
thru the repeated process, or fill out half the Profile form to click edit
additional only to find out any data they changed was not saved and have to
go back and edit it all over again. Not going to bother saving to data to
session and all that since this area of the profile is not to important in
terms of the site.

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

Dave, what is your database design for this issue?
As scs stated, are you saving the additional information in a separate table
or in the profile table as 10 independent columns?
Depending on your answer, we will try better to help you :) In my own
opinion, scs' idea is sound!
And if I remember correctly, then CakePHP can accepts more than one record
for the related table if you use the form field definition as
Model.indexNumber.fieldname - example: Userinfo.0.uservalue.
That should also make it easier for you to create the 10 additional
information form fields by looping!
Enjoy,
John

On Jan 6, 9:45 pm, "Dave" <make.cake.b...@gmail.com> wrote:
> 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 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: