Re: $form-input() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
 Really?  I just did one with $form-input('fieldname', array('values'
 = $array)) and it worked just fine.  Interesting...

Nope, doesn't work. Strange. When I look in
cake/libs/view/helpers/form.php, it mentions $options['options'] in
several places. I couldn't find any reference to $options['values'].

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-20 Thread Chris Hartjes

On 9/20/07, Martin Schapendonk [EMAIL PROTECTED] wrote:


 Nope, doesn't work. Strange. When I look in
 cake/libs/view/helpers/form.php, it mentions $options['options'] in
 several places. I couldn't find any reference to $options['values'].

Well, the array I passed in was one I created using generateList() so
it had key = value pairs.  That might've made the difference.


-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  Just build it, damnit!

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
 Well, the array I passed in was one I created using generateList() so
 it had key = value pairs.  That might've made the difference.

Probably not, because I did also.

Controller: $audiences = $this-Activity-Audience-generateList();
View: echo $form-input('ade_id', array('options'=$audiences));

Are you using a nightly build? Did anything change between 5427alpha and today?

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-20 Thread Chris Hartjes

On 9/20/07, Martin Schapendonk [EMAIL PROTECTED] wrote:

 2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
  Well, the array I passed in was one I created using generateList() so
  it had key = value pairs.  That might've made the difference.

 Probably not, because I did also.

 Controller: $audiences = $this-Activity-Audience-generateList();
 View: echo $form-input('ade_id', array('options'=$audiences));

$values is the output of generateList()

echo $form-input('field', array('label' = __('label', true),
'values' = $values));

and that works just fine.  Used it all over the place.

So, I wonder who is right here...

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  Just build it, damnit!

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
  Probably not, because I did also.
 
  Controller: $audiences = $this-Activity-Audience-generateList();
  View: echo $form-input('ade_id', array('options'=$audiences));

 $values is the output of generateList()

 echo $form-input('field', array('label' = __('label', true),
 'values' = $values));

 and that works just fine.  Used it all over the place.

 So, I wonder who is right here...

I give up. 'values' doesn't work for me, 'options' does.
pr($audiences) shows me a nice key=value array.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-20 Thread Chris Hartjes

On 9/20/07, Martin Schapendonk [EMAIL PROTECTED] wrote:
 I give up. 'values' doesn't work for me, 'options' does.
 pr($audiences) shows me a nice key=value array.


Hey, I'm not saying you're wrong.  I'm just wondering why my method
seems to work okay for me, and I'm using the latest bleeding-edge
version of Cake 1.2.x.x.


-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  Just build it, damnit!

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-20 Thread Martin Schapendonk

2007/9/20, Chris Hartjes [EMAIL PROTECTED]:
 Hey, I'm not saying you're wrong.  I'm just wondering why my method
 seems to work okay for me, and I'm using the latest bleeding-edge
 version of Cake 1.2.x.x.

I just tried bleeding edge Cake (r5676 of the 1.2.x.x branch). Still
the same result - options works, values doesn't.

I'm using Oracle as database, although I hope that should not matter.

I'll send you a small proof-of-concept (directly, not through the
list) that shows what code is working for me.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-19 Thread Martin Schapendonk

2007/9/18, Chris Hartjes [EMAIL PROTECTED]:
  How should I change the call to $form-input() to show a select-list?
  The list with audiences is available to the view in variable
  $audiences.

 Try this code using 1.2.x.x

 $form-input('ade_id', array('values' = $audiences));

Thanks for pointing me in the right direction.

It was array('options'=$audiences) instead of values, but I found it.

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-19 Thread Chris Hartjes

On 9/19/07, Martin Schapendonk [EMAIL PROTECTED] wrote:

 2007/9/18, Chris Hartjes [EMAIL PROTECTED]:
   How should I change the call to $form-input() to show a select-list?
   The list with audiences is available to the view in variable
   $audiences.
 
  Try this code using 1.2.x.x
 
  $form-input('ade_id', array('values' = $audiences));

 Thanks for pointing me in the right direction.

 It was array('options'=$audiences) instead of values, but I found it.


Really?  I just did one with $form-input('fieldname', array('values'
= $array)) and it worked just fine.  Interesting...

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  Just build it, damnit!

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



$form-input() syntax for associations not following Cake conventions

2007-09-18 Thread Martin Schapendonk

Hi,

Using latest cake alpha (r5427).

I have an association between two models that doesn't follow Cake
conventions (Activity belongsTo Audience and its counterpart
Audience hasMany Activity).

Cake's convention demands that the association is on
Activity.audience_id. In my case, it isn't, it's on Activity.ade_id.

I got my models/controllers set up to handle this. My view shows:

echo $form-input('ade_id');

FormHelper shows me a plain text box, but I expected a nice
select-list with all available audiences.

How should I change the call to $form-input() to show a select-list?
The list with audiences is available to the view in variable
$audiences.

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: $form-input() syntax for associations not following Cake conventions

2007-09-18 Thread Chris Hartjes

On 9/18/07, Martin Schapendonk [EMAIL PROTECTED] wrote:

 How should I change the call to $form-input() to show a select-list?
 The list with audiences is available to the view in variable
 $audiences.

Try this code using 1.2.x.x

$form-input('ade_id', array('values' = $audiences));

Hope that helps.



-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  Just build it, damnit!

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---