Re: Bug? - $form->select() doesn't populate data, but $form->input() does
Need to stop banging your head nate, not really good for the frontal lobes. I'm by no means a PHP expert. I also didn't think I need to debug the code to figure out the 'subtle' different between autopopulation of options vs. values. I'm telling you what I see from a beginner's standpoint. All I see is $form->inpu() = data $form->select() = no data That oneline: $form->select("group_id", $groups); was the only thing I needed, ThanX As you can see from the replies, I'm not the only one who thought it was a bit weird. Y'all need to calm down man... lol --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
*Bangs head against desk*. I can't make this a whole lot clearer. What I am telling you is this: When you either: (a) submit a form via POST, and you return to the form again (let's say the submission doesn't validate) *or* (b) load a record into $this->data Then: FormHelper::select() uses said data to "auto-populate" the VALUE of the select element, i.e. the initially-selected item (take special note of the emphasis on the word "value"). This behavior is consistently implemented across all form fields generated by FormHelper. What Does *Not* Happen: FormHelper::select() does not detect any view variables to automatically use them in place of the $options parameter. There is a subtle but important difference between select elements and all other form elements generated by FormHelper: select elements are the only ones that require a set of options when rendering. No other form element requires this. Therefore, in order to maintain consistency with other form field generator methods, no extra magic functionality is used dealing with this list of options. However, does that mean you have to use a high-level wrapper method just to get a select element to display a list of options? Heavens no. In fact, that would have been pretty retarded of me had I set it up that way. All you need to do is *use the method as it was designed*, and pass it a parameter, like so: $form->select("group_id", $groups); Simple, clear, explicit. Hardly worth a ticket. Hey, that rhymes. On Mar 4, 2:49 pm, Baz <[EMAIL PROTECTED]> wrote: > I understand that they're not supposed to do the same thing. However, > I can assure you that a $form->select('group_id') does not get > populated. Not sure what the issue is. > > I discovered this while trying to used a select list without a label. > I was forced to use: $form->input('group_id', array('type' => > 'select', 'label' => false)); > > Granted, I haven't debugged through the code: > > This is what I've done: > Bake a basic set controllers and views from User with a belongsTo on Group. > > On the add/edit I simply change $form->input('group_id') to > $form->select('groupd_id'). > The select list is empty. > > All I know is that it if I change $form->input('group_id') to > $form->text('group_id') it is populated, however select has an empty > drop down list. Not really sure what else to tell you. > > I'm not sure what the expected behavior is, but what I expect (based > on other form furctions) doesn't seem to be happening. If my > expectation is unreasonable then there should be some mention in the > book.cakephp.org with specific reference to why this shouldn't work > with select boxes. > > Again, I'm using 6311 beta. > > Already filed an enhancement ticket:https://trac.cakephp.org/ticket/4270 > > On Tue, Mar 4, 2008 at 1:19 PM, nate <[EMAIL PROTECTED]> wrote: > > > $form->select (and therefore $form->input("...", array("type" => > > "select)); by extension) *are* populated from $this->data, just like > > everything else (i.e. all other form field types). The only thing > > different about a select input field is the need to generate available > > options. That's where you're getting confused: the $options parameter > > in FormHelper::select() has no parallel in any other form field. > > Since $form->select() is a base method and not a wrapper method, it > > does not utilize any more magic than necessary. > > > On Mar 4, 1:17 pm, Baz <[EMAIL PROTECTED]> wrote: > > > I don't think I'm talking bout POST data. I'm taking about, through > > > setting a variable via $this->MyModel->find('list'). > > > > All the other fields get set directly through $this->data. However, > > > I'm talking specifically about: > > > > $this->select('group_id') > > > > as compared to: > > > $this->input('group_id', array('type' => 'select')) does. > > > > On Tue, Mar 4, 2008 at 9:03 AM, nate <[EMAIL PROTECTED]> wrote: > > > > > $form->select() *does* auto-populate... from POST data. Just like > > > > everything else. So no, this is not a bug. The non-wrapper methods > > > > keep the magic to a necessary minimum. > > > > > On Mar 4, 1:56 am, Baz <[EMAIL PROTECTED]> wrote: > > > > > Well, that's my question: > > > > > > Is this is bug (oversight)? $form->text, $form->checkbox both > > > > > autofill, so should I report this? > > > > > > On Tue, Mar 4, 2008 at 12:34 AM, Samuel DeVore <[EMAIL PROTECTED]> > > wrote: > > > > > > > On Mon, Mar 3, 2008 at 11:24 PM, Baz <[EMAIL PROTECTED]> wrote: > > > > > > > > I take it you meant: > > > > > > > $form->select('groups')? > > > > > > > $groups = $this->MyModel->find('list') > > > > > > $this->set(compact('groups')); > > > > > > > Is what I was thinking, but I don't think FormHelper::select > > supports > > > > > > the auto finding of the options array like input does, if you > > look at > > > > > > the code from the api > > > > > > > http://api.cakephp.org/1.2/f
Re: Bug? - $form->select() doesn't populate data, but $form->input() does
I understand that they're not supposed to do the same thing. However, I can assure you that a $form->select('group_id') does not get populated. Not sure what the issue is. I discovered this while trying to used a select list without a label. I was forced to use: $form->input('group_id', array('type' => 'select', 'label' => false)); Granted, I haven't debugged through the code: This is what I've done: Bake a basic set controllers and views from User with a belongsTo on Group. On the add/edit I simply change $form->input('group_id') to $form->select('groupd_id'). The select list is empty. All I know is that it if I change $form->input('group_id') to $form->text('group_id') it is populated, however select has an empty drop down list. Not really sure what else to tell you. I'm not sure what the expected behavior is, but what I expect (based on other form furctions) doesn't seem to be happening. If my expectation is unreasonable then there should be some mention in the book.cakephp.org with specific reference to why this shouldn't work with select boxes. Again, I'm using 6311 beta. Already filed an enhancement ticket: https://trac.cakephp.org/ticket/4270 On Tue, Mar 4, 2008 at 1:19 PM, nate <[EMAIL PROTECTED]> wrote: > > $form->select (and therefore $form->input("...", array("type" => > "select)); by extension) *are* populated from $this->data, just like > everything else (i.e. all other form field types). The only thing > different about a select input field is the need to generate available > options. That's where you're getting confused: the $options parameter > in FormHelper::select() has no parallel in any other form field. > Since $form->select() is a base method and not a wrapper method, it > does not utilize any more magic than necessary. > > > On Mar 4, 1:17 pm, Baz <[EMAIL PROTECTED]> wrote: > > I don't think I'm talking bout POST data. I'm taking about, through > > setting a variable via $this->MyModel->find('list'). > > > > All the other fields get set directly through $this->data. However, > > I'm talking specifically about: > > > > $this->select('group_id') > > > > as compared to: > > $this->input('group_id', array('type' => 'select')) does. > > > > > On Tue, Mar 4, 2008 at 9:03 AM, nate <[EMAIL PROTECTED]> wrote: > > > > > $form->select() *does* auto-populate... from POST data. Just like > > > everything else. So no, this is not a bug. The non-wrapper methods > > > keep the magic to a necessary minimum. > > > > > On Mar 4, 1:56 am, Baz <[EMAIL PROTECTED]> wrote: > > > > Well, that's my question: > > > > > > Is this is bug (oversight)? $form->text, $form->checkbox both > > > > autofill, so should I report this? > > > > > > On Tue, Mar 4, 2008 at 12:34 AM, Samuel DeVore <[EMAIL PROTECTED]> > wrote: > > > > > > > On Mon, Mar 3, 2008 at 11:24 PM, Baz <[EMAIL PROTECTED]> wrote: > > > > > > > > I take it you meant: > > > > > > $form->select('groups')? > > > > > > > $groups = $this->MyModel->find('list') > > > > > $this->set(compact('groups')); > > > > > > > Is what I was thinking, but I don't think FormHelper::select > supports > > > > > the auto finding of the options array like input does, if you look > at > > > > > the code from the api > > > > > > > http://api.cakephp.org/1.2/form_8php-source.html#l00491around line > > > > > > 535 you'll see where that is autofilled from > > > > > > > in FormHelper::select > > > > > http://api.cakephp.org/1.2/form_8php-source.html#l01002you can see > > > > > > > that there is no similar feature. So if you want it to work like > > > > > input you probably need to file an enhancement ticket > > > > > > > -- > > > > > -- > > > > > > > (the old fart) the advice is free, the lack of crankiness will cost > you > > > > > > > - its a fine line between a real question and an idiot > > > > > > > > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > > > > > http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > > > > > http://blog.samdevore.com/cakephp-pages/i-cant-bake/ > > > --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
$form->select (and therefore $form->input("...", array("type" => "select)); by extension) *are* populated from $this->data, just like everything else (i.e. all other form field types). The only thing different about a select input field is the need to generate available options. That's where you're getting confused: the $options parameter in FormHelper::select() has no parallel in any other form field. Since $form->select() is a base method and not a wrapper method, it does not utilize any more magic than necessary. On Mar 4, 1:17 pm, Baz <[EMAIL PROTECTED]> wrote: > I don't think I'm talking bout POST data. I'm taking about, through > setting a variable via $this->MyModel->find('list'). > > All the other fields get set directly through $this->data. However, > I'm talking specifically about: > > $this->select('group_id') > > as compared to: > $this->input('group_id', array('type' => 'select')) does. > > On Tue, Mar 4, 2008 at 9:03 AM, nate <[EMAIL PROTECTED]> wrote: > > > $form->select() *does* auto-populate... from POST data. Just like > > everything else. So no, this is not a bug. The non-wrapper methods > > keep the magic to a necessary minimum. > > > On Mar 4, 1:56 am, Baz <[EMAIL PROTECTED]> wrote: > > > Well, that's my question: > > > > Is this is bug (oversight)? $form->text, $form->checkbox both > > > autofill, so should I report this? > > > > On Tue, Mar 4, 2008 at 12:34 AM, Samuel DeVore <[EMAIL PROTECTED]> wrote: > > > > > On Mon, Mar 3, 2008 at 11:24 PM, Baz <[EMAIL PROTECTED]> wrote: > > > > > > I take it you meant: > > > > > $form->select('groups')? > > > > > $groups = $this->MyModel->find('list') > > > > $this->set(compact('groups')); > > > > > Is what I was thinking, but I don't think FormHelper::select supports > > > > the auto finding of the options array like input does, if you look at > > > > the code from the api > > > > > http://api.cakephp.org/1.2/form_8php-source.html#l00491around line > > > > 535 you'll see where that is autofilled from > > > > > in FormHelper::select > > > > http://api.cakephp.org/1.2/form_8php-source.html#l01002you can see > > > > that there is no similar feature. So if you want it to work like > > > > input you probably need to file an enhancement ticket > > > > > -- > > > > -- > > > > > (the old fart) the advice is free, the lack of crankiness will cost you > > > > > - its a fine line between a real question and an idiot > > > > > > > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > > > > http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > > > > http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
I don't think I'm talking bout POST data. I'm taking about, through setting a variable via $this->MyModel->find('list'). All the other fields get set directly through $this->data. However, I'm talking specifically about: $this->select('group_id') as compared to: $this->input('group_id', array('type' => 'select')) does. On Tue, Mar 4, 2008 at 9:03 AM, nate <[EMAIL PROTECTED]> wrote: > > $form->select() *does* auto-populate... from POST data. Just like > everything else. So no, this is not a bug. The non-wrapper methods > keep the magic to a necessary minimum. > > > On Mar 4, 1:56 am, Baz <[EMAIL PROTECTED]> wrote: > > Well, that's my question: > > > > Is this is bug (oversight)? $form->text, $form->checkbox both > > autofill, so should I report this? > > > > On Tue, Mar 4, 2008 at 12:34 AM, Samuel DeVore <[EMAIL PROTECTED]> wrote: > > > > > > > On Mon, Mar 3, 2008 at 11:24 PM, Baz <[EMAIL PROTECTED]> wrote: > > > > > > I take it you meant: > > > > $form->select('groups')? > > > > > $groups = $this->MyModel->find('list') > > > $this->set(compact('groups')); > > > > > Is what I was thinking, but I don't think FormHelper::select supports > > > the auto finding of the options array like input does, if you look at > > > the code from the api > > > > > http://api.cakephp.org/1.2/form_8php-source.html#l00491 around line > > > 535 you'll see where that is autofilled from > > > > > in FormHelper::select > > > http://api.cakephp.org/1.2/form_8php-source.html#l01002 you can see > > > that there is no similar feature. So if you want it to work like > > > input you probably need to file an enhancement ticket > > > > > -- > > > -- > > > > > (the old fart) the advice is free, the lack of crankiness will cost you > > > > > - its a fine line between a real question and an idiot > > > > > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > > > http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > > > http://blog.samdevore.com/cakephp-pages/i-cant-bake/ > > > --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
$form->select() *does* auto-populate... from POST data. Just like everything else. So no, this is not a bug. The non-wrapper methods keep the magic to a necessary minimum. On Mar 4, 1:56 am, Baz <[EMAIL PROTECTED]> wrote: > Well, that's my question: > > Is this is bug (oversight)? $form->text, $form->checkbox both > autofill, so should I report this? > > On Tue, Mar 4, 2008 at 12:34 AM, Samuel DeVore <[EMAIL PROTECTED]> wrote: > > > On Mon, Mar 3, 2008 at 11:24 PM, Baz <[EMAIL PROTECTED]> wrote: > > > > I take it you meant: > > > $form->select('groups')? > > > $groups = $this->MyModel->find('list') > > $this->set(compact('groups')); > > > Is what I was thinking, but I don't think FormHelper::select supports > > the auto finding of the options array like input does, if you look at > > the code from the api > > > http://api.cakephp.org/1.2/form_8php-source.html#l00491 around line > > 535 you'll see where that is autofilled from > > > in FormHelper::select > > http://api.cakephp.org/1.2/form_8php-source.html#l01002 you can see > > that there is no similar feature. So if you want it to work like > > input you probably need to file an enhancement ticket > > > -- > > -- > > > (the old fart) the advice is free, the lack of crankiness will cost you > > > - its a fine line between a real question and an idiot > > > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > > http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > > http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
Well, that's my question: Is this is bug (oversight)? $form->text, $form->checkbox both autofill, so should I report this? On Tue, Mar 4, 2008 at 12:34 AM, Samuel DeVore <[EMAIL PROTECTED]> wrote: > > On Mon, Mar 3, 2008 at 11:24 PM, Baz <[EMAIL PROTECTED]> wrote: > > > > I take it you meant: > > $form->select('groups')? > > > $groups = $this->MyModel->find('list') > $this->set(compact('groups')); > > Is what I was thinking, but I don't think FormHelper::select supports > the auto finding of the options array like input does, if you look at > the code from the api > > http://api.cakephp.org/1.2/form_8php-source.html#l00491 around line > 535 you'll see where that is autofilled from > > in FormHelper::select > http://api.cakephp.org/1.2/form_8php-source.html#l01002 you can see > that there is no similar feature. So if you want it to work like > input you probably need to file an enhancement ticket > > -- > -- > > > (the old fart) the advice is free, the lack of crankiness will cost you > > - its a fine line between a real question and an idiot > > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > http://blog.samdevore.com/cakephp-pages/i-cant-bake/ > > > > --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
On Mon, Mar 3, 2008 at 11:24 PM, Baz <[EMAIL PROTECTED]> wrote: > > I take it you meant: > $form->select('groups')? > $groups = $this->MyModel->find('list') $this->set(compact('groups')); Is what I was thinking, but I don't think FormHelper::select supports the auto finding of the options array like input does, if you look at the code from the api http://api.cakephp.org/1.2/form_8php-source.html#l00491 around line 535 you'll see where that is autofilled from in FormHelper::select http://api.cakephp.org/1.2/form_8php-source.html#l01002 you can see that there is no similar feature. So if you want it to work like input you probably need to file an enhancement ticket -- -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
I take it you meant: $form->select('groups')? That doesn't work either. On Tue, Mar 4, 2008 at 12:19 AM, Samuel DeVore <[EMAIL PROTECTED]> wrote: > > try groups > > > > On Mon, Mar 3, 2008 at 11:07 PM, Baz <[EMAIL PROTECTED]> wrote: > > > > Stumbled onto this, hoping someone could guide me as to what is the > > expected behavior before I file a ticket in trac: > > > > Trying to add a select drop down list: > > > > Let's assume, we have a simple model with a belongs_to Group, he we > > have a group_id. > > //controller: > > $group = $this->MyModel->find('list') > > $this->set(compact('group')); > > > > //veiw: > > // This works fine: > > $form->input('group_id') > > > > // This does not populate the data: > > $form->select('group_id'); > > > > > > > > > > > -- > -- > (the old fart) the advice is free, the lack of crankiness will cost you > > - its a fine line between a real question and an idiot > > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > http://blog.samdevore.com/cakephp-pages/i-cant-bake/ > > > > --~--~-~--~~~---~--~~ 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: Bug? - $form->select() doesn't populate data, but $form->input() does
try groups On Mon, Mar 3, 2008 at 11:07 PM, Baz <[EMAIL PROTECTED]> wrote: > > Stumbled onto this, hoping someone could guide me as to what is the > expected behavior before I file a ticket in trac: > > Trying to add a select drop down list: > > Let's assume, we have a simple model with a belongs_to Group, he we > have a group_id. > //controller: > $group = $this->MyModel->find('list') > $this->set(compact('group')); > > //veiw: > // This works fine: > $form->input('group_id') > > // This does not populate the data: > $form->select('group_id'); > > > > -- -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Bug? - $form->select() doesn't populate data, but $form->input() does
Stumbled onto this, hoping someone could guide me as to what is the expected behavior before I file a ticket in trac: Trying to add a select drop down list: Let's assume, we have a simple model with a belongs_to Group, he we have a group_id. //controller: $group = $this->MyModel->find('list') $this->set(compact('group')); //veiw: // This works fine: $form->input('group_id') // This does not populate the data: $form->select('group_id'); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---