Re: correct way to create multiple text forms in a table

2008-12-03 Thread Todd M

Its all one form. The form goes to a model that has a belongs to
relationship to the x & y models. So the controller to initially
create the form would have

$x= $this->X->findAllBySomeId($some_id);
$this->set('x'', $x);
$y = $this->Y->findAllByDifferentId($different_id);
$this->set('y', $y);

There is a relationship between X & Y model, but I don't think that is
important for this situation.

When $x & $y are given to the view. The view will have only one form.
This form deals with the Z model. The Z model has belongsto X and
belongsToY fields. That is the Z model has a unique id, and x_id,
y_id, and value column.
An example is.
Array
(
[Z] => Array
(
[x_id] => 'value'
[y_id]=> 'value'
[description] => 'description for Z'
)
)

I wanted to use a table that is XxY wide. So in my original example
there was 2 entries for both X & Y from the findAll functions. This
would produce a 2x2 table.


The part that I don't quite understand is how to create the forms with
knowledge of the X's & Y's ID. so I know how to properly save it to
the Z model, using a saveAll. I have only had experience with doing
this one entry at a time.

Thanks for assistance in advance,
-T



On Dec 3, 1:34 am, brian <[EMAIL PROTECTED]> wrote:
> Could you query again, but without all the table display stuff? You have 4
> text boxes in a view and ... what?
>
> What's the model name, and what models is it associated to (and how)?
>
> Or is it 4 separate forms? 5?
>
> On Wed, Dec 3, 2008 at 12:27 AM, Todd M <[EMAIL PROTECTED]> wrote:
>
> > I'm creating a table where the top header row and left column are
> > text, but everything in the middle will be a text box. So if the table
> > was 5x5, there would be a 4x4 matrix of text boxes.
>
> > Each of these text inputs will represent a different entry to be saved
> > at the same model. My plan is to have one submit and the controller
> > will will call a model->saveall function. However of the text box
> > forms has a id associated to the top row and leftmost column. In other
> > words the form is saving to a model that has belongsTo association
> > with the top row and left.
>
> > Is there something that I'm missing on how to have this association
> > linked with each $form->input.
>
> > (Note:example has top left cell blank intentionally)
> > 
> >    
> >  x1
> >  x2
> > 
> > 
> >  y1
> >  text form x1/y1 for modelz
> >  text form x2/y1 for modelz
> > 
> > 
> >  y2
> >  text form x1/y2 for modelz
> >  text form x2/y2 for modelz
> > 
>
> > So the submit would save four entries into the model.
>
> > My question is how to use the form helper? And/or is there other best
> > practices out there.
>
> > The only solution that I can come up with is to not use the
> > 'Modelname.fieldname' in the naming convention and have the controller
> > parse the name into cake naming convention before saving.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: correct way to create multiple text forms in a table

2008-12-02 Thread brian
Could you query again, but without all the table display stuff? You have 4
text boxes in a view and ... what?

What's the model name, and what models is it associated to (and how)?

Or is it 4 separate forms? 5?

On Wed, Dec 3, 2008 at 12:27 AM, Todd M <[EMAIL PROTECTED]> wrote:

>
> I'm creating a table where the top header row and left column are
> text, but everything in the middle will be a text box. So if the table
> was 5x5, there would be a 4x4 matrix of text boxes.
>
> Each of these text inputs will represent a different entry to be saved
> at the same model. My plan is to have one submit and the controller
> will will call a model->saveall function. However of the text box
> forms has a id associated to the top row and leftmost column. In other
> words the form is saving to a model that has belongsTo association
> with the top row and left.
>
> Is there something that I'm missing on how to have this association
> linked with each $form->input.
>
> (Note:example has top left cell blank intentionally)
> 
>
>  x1
>  x2
> 
> 
>  y1
>  text form x1/y1 for modelz
>  text form x2/y1 for modelz
> 
> 
>  y2
>  text form x1/y2 for modelz
>  text form x2/y2 for modelz
> 
>
> So the submit would save four entries into the model.
>
> My question is how to use the form helper? And/or is there other best
> practices out there.
>
> The only solution that I can come up with is to not use the
> 'Modelname.fieldname' in the naming convention and have the controller
> parse the name into cake naming convention before saving.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



correct way to create multiple text forms in a table

2008-12-02 Thread Todd M

I'm creating a table where the top header row and left column are
text, but everything in the middle will be a text box. So if the table
was 5x5, there would be a 4x4 matrix of text boxes.

Each of these text inputs will represent a different entry to be saved
at the same model. My plan is to have one submit and the controller
will will call a model->saveall function. However of the text box
forms has a id associated to the top row and leftmost column. In other
words the form is saving to a model that has belongsTo association
with the top row and left.

Is there something that I'm missing on how to have this association
linked with each $form->input.

(Note:example has top left cell blank intentionally)


  x1
  x2


  y1
  text form x1/y1 for modelz
  text form x2/y1 for modelz


  y2
  text form x1/y2 for modelz
  text form x2/y2 for modelz


So the submit would save four entries into the model.

My question is how to use the form helper? And/or is there other best
practices out there.

The only solution that I can come up with is to not use the
'Modelname.fieldname' in the naming convention and have the controller
parse the name into cake naming convention before saving.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---