Re: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread Martin Westin


I can only think of one far-fetched thing to check. Make sure you
specify the inputs with the Modelname present.
$html->input(Modelname.fieldname);

Or get around requestAction of-course :)

/Martin


On Jan 15, 8:08 pm, jwerd  wrote:
> Sorry, it was about 3am when I wrote that and I was prettty vague on
> the precise problem.
>
> The automagicness (as far as cake finding out what field goes where)
> is working fine, the problem I'm having is with the drop downs,
> basically the select box outputs in a weird form:
>
> it shows every field from the shows table in the form instead of like
>
> Value 1
> Value 2
> Value 3
> Value 4
> Value 5
>
> Like it would if I directly acesss /show_attendees/add/
>
> It looks like
> 1
> 2
> 3
> 4
> Value 1
> Some spacing
> 5
> 6
> 7
> 8
>
> That's the only thing that's the issue now.  Do you have any idea how
> I can fix that?
>
> On Jan 15, 10:07 am, Martin Westin  wrote:
>
> > A quick suggestion to follow along with Lecter's reply:
>
> > Since it is an add form it does not show any pre-populated data,
> > right? I am not sure what you mean by automagicness, though? Do you
> > mean Cakes ability to figure out that one thing is a textfield and
> > another is a dropdown?
>
> > Try to put your add form (the one you get from the requestAction call)
> > into an element and have both views call that element. That should
> > yield the same form in both views without an extra request. To get
> > some possibly lost automagicness you may have to include the attendee-
> > model in the controller (so the form-helper can read the schema), but
> > that is a guess. I haven't looked too closely into the form helper
> > code.
>
> > Please, don't take this the wrong way:
> > Your question sounds like you are thinking that view, controller and
> > model are more tightly linked than you need to. The controller does
> > not "own" the model of the same name. You can often come far using
> > this one to one relationship but you will also come across places
> > where one Controller makes use of (and even saves data to) "another"
> > Model. An ExampleController and the example-views can be seen as
> > pretty tightly integrated. But the ExampleModel does not have to be
> > accessed from only the ExampleController.
>
> > I used to think I was "cheating" when I defined $uses = array
> > ('AnotherModel') in a controller, but that is actually good design...
> > at least compared to using requestAction... but I am not expert on MVC
> > design, so I may be shooting myself in the foot here. ;)
>
> > good luck.
> > /Martin
>
> > On Jan 15, 10:41 am, "dr. Hannibal Lecter" 
> > wrote:
>
> > > It is very difficult to see what the problem is without the code.
> > > Also, it would be the best if you can avoid the requestAction :-)
>
> > > On Jan 15, 10:19 am, jwerd  wrote:
>
> > > > Hello fellow bakers, I've searched this group before I was going to
> > > > post this question but I cant' seem to find my current dilema
> > > > addressed yet.
>
> > > > I have two controllers, which serve different purposes, but for the
> > > > sake of this example, they share some things in common :
>
> > > > shows_controller is used to pretty much the shows in the system
>
> > > > show_attendees_controller is used to capture the attendees of any
> > > > given show
>
> > > > On the view /shows/view/# page I need to include the "add form" of
> > > > show_attendees/add/ but what's happening is, it's not doing all the
> > > > automagicness, and it's creating weird drop down menus that don't
> > > > really capture the same format they do if I was directly accessing
> > > > them from /show_attendees/add/.
>
> > > > Also, I'm using requestAction, just so everyone knows.
>
> > > > Any help is much appreciated.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread jwerd

Sorry, it was about 3am when I wrote that and I was prettty vague on
the precise problem.

The automagicness (as far as cake finding out what field goes where)
is working fine, the problem I'm having is with the drop downs,
basically the select box outputs in a weird form:

it shows every field from the shows table in the form instead of like

Value 1
Value 2
Value 3
Value 4
Value 5

Like it would if I directly acesss /show_attendees/add/

It looks like
1
2
3
4
Value 1
Some spacing
5
6
7
8

That's the only thing that's the issue now.  Do you have any idea how
I can fix that?

On Jan 15, 10:07 am, Martin Westin  wrote:
> A quick suggestion to follow along with Lecter's reply:
>
> Since it is an add form it does not show any pre-populated data,
> right? I am not sure what you mean by automagicness, though? Do you
> mean Cakes ability to figure out that one thing is a textfield and
> another is a dropdown?
>
> Try to put your add form (the one you get from the requestAction call)
> into an element and have both views call that element. That should
> yield the same form in both views without an extra request. To get
> some possibly lost automagicness you may have to include the attendee-
> model in the controller (so the form-helper can read the schema), but
> that is a guess. I haven't looked too closely into the form helper
> code.
>
> Please, don't take this the wrong way:
> Your question sounds like you are thinking that view, controller and
> model are more tightly linked than you need to. The controller does
> not "own" the model of the same name. You can often come far using
> this one to one relationship but you will also come across places
> where one Controller makes use of (and even saves data to) "another"
> Model. An ExampleController and the example-views can be seen as
> pretty tightly integrated. But the ExampleModel does not have to be
> accessed from only the ExampleController.
>
> I used to think I was "cheating" when I defined $uses = array
> ('AnotherModel') in a controller, but that is actually good design...
> at least compared to using requestAction... but I am not expert on MVC
> design, so I may be shooting myself in the foot here. ;)
>
> good luck.
> /Martin
>
> On Jan 15, 10:41 am, "dr. Hannibal Lecter" 
> wrote:
>
> > It is very difficult to see what the problem is without the code.
> > Also, it would be the best if you can avoid the requestAction :-)
>
> > On Jan 15, 10:19 am, jwerd  wrote:
>
> > > Hello fellow bakers, I've searched this group before I was going to
> > > post this question but I cant' seem to find my current dilema
> > > addressed yet.
>
> > > I have two controllers, which serve different purposes, but for the
> > > sake of this example, they share some things in common :
>
> > > shows_controller is used to pretty much the shows in the system
>
> > > show_attendees_controller is used to capture the attendees of any
> > > given show
>
> > > On the view /shows/view/# page I need to include the "add form" of
> > > show_attendees/add/ but what's happening is, it's not doing all the
> > > automagicness, and it's creating weird drop down menus that don't
> > > really capture the same format they do if I was directly accessing
> > > them from /show_attendees/add/.
>
> > > Also, I'm using requestAction, just so everyone knows.
>
> > > Any help is much appreciated.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread Martin Westin


A quick suggestion to follow along with Lecter's reply:

Since it is an add form it does not show any pre-populated data,
right? I am not sure what you mean by automagicness, though? Do you
mean Cakes ability to figure out that one thing is a textfield and
another is a dropdown?

Try to put your add form (the one you get from the requestAction call)
into an element and have both views call that element. That should
yield the same form in both views without an extra request. To get
some possibly lost automagicness you may have to include the attendee-
model in the controller (so the form-helper can read the schema), but
that is a guess. I haven't looked too closely into the form helper
code.


Please, don't take this the wrong way:
Your question sounds like you are thinking that view, controller and
model are more tightly linked than you need to. The controller does
not "own" the model of the same name. You can often come far using
this one to one relationship but you will also come across places
where one Controller makes use of (and even saves data to) "another"
Model. An ExampleController and the example-views can be seen as
pretty tightly integrated. But the ExampleModel does not have to be
accessed from only the ExampleController.

I used to think I was "cheating" when I defined $uses = array
('AnotherModel') in a controller, but that is actually good design...
at least compared to using requestAction... but I am not expert on MVC
design, so I may be shooting myself in the foot here. ;)

good luck.
/Martin


On Jan 15, 10:41 am, "dr. Hannibal Lecter" 
wrote:
> It is very difficult to see what the problem is without the code.
> Also, it would be the best if you can avoid the requestAction :-)
>
> On Jan 15, 10:19 am, jwerd  wrote:
>
> > Hello fellow bakers, I've searched this group before I was going to
> > post this question but I cant' seem to find my current dilema
> > addressed yet.
>
> > I have two controllers, which serve different purposes, but for the
> > sake of this example, they share some things in common :
>
> > shows_controller is used to pretty much the shows in the system
>
> > show_attendees_controller is used to capture the attendees of any
> > given show
>
> > On the view /shows/view/# page I need to include the "add form" of
> > show_attendees/add/ but what's happening is, it's not doing all the
> > automagicness, and it's creating weird drop down menus that don't
> > really capture the same format they do if I was directly accessing
> > them from /show_attendees/add/.
>
> > Also, I'm using requestAction, just so everyone knows.
>
> > Any help is much appreciated.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread dr. Hannibal Lecter

It is very difficult to see what the problem is without the code.
Also, it would be the best if you can avoid the requestAction :-)

On Jan 15, 10:19 am, jwerd  wrote:
> Hello fellow bakers, I've searched this group before I was going to
> post this question but I cant' seem to find my current dilema
> addressed yet.
>
> I have two controllers, which serve different purposes, but for the
> sake of this example, they share some things in common :
>
> shows_controller is used to pretty much the shows in the system
>
> show_attendees_controller is used to capture the attendees of any
> given show
>
> On the view /shows/view/# page I need to include the "add form" of
> show_attendees/add/ but what's happening is, it's not doing all the
> automagicness, and it's creating weird drop down menus that don't
> really capture the same format they do if I was directly accessing
> them from /show_attendees/add/.
>
> Also, I'm using requestAction, just so everyone knows.
>
> Any help is much appreciated.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread jwerd

Hello fellow bakers, I've searched this group before I was going to
post this question but I cant' seem to find my current dilema
addressed yet.

I have two controllers, which serve different purposes, but for the
sake of this example, they share some things in common :

shows_controller is used to pretty much the shows in the system

show_attendees_controller is used to capture the attendees of any
given show

On the view /shows/view/# page I need to include the "add form" of
show_attendees/add/ but what's happening is, it's not doing all the
automagicness, and it's creating weird drop down menus that don't
really capture the same format they do if I was directly accessing
them from /show_attendees/add/.

Also, I'm using requestAction, just so everyone knows.

Any help is much appreciated.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---