Re: problem select menu with "optgroups"

2010-07-29 Thread hoss7
thank you,you are my hero, can i ask you one question about my problem to save data? if you want help me please see this link: http://groups.google.com/group/cake-php/t/6749e1ba04af243a Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions

Re: problem select menu with "optgroups"

2010-07-29 Thread cricket
On Thu, Jul 29, 2010 at 6:45 AM, hoss7 wrote: > can you convert $form->select to $form->input in view? In some cases, yes, FormHelper will create a select list with the input() method. It depends on what you pass to it. I prefer to use select() as it's more intuitive. Check out the new CakePHP Q

Re: problem select menu with "optgroups"

2010-07-29 Thread cricket
On Thu, Jul 29, 2010 at 6:14 AM, hoss7 wrote: > @circket you fix my problem,i have litle problem i need like this: > > input('field', array('options' => array(1,2,3,4,5), > 'empty' => '(choose one)')); ?> > > use 'empty' => '(choose one)' in echo $form->select('category_id', > $options); what i am

Re: problem select menu with "optgroups"

2010-07-29 Thread cricket
On Thu, Jul 29, 2010 at 3:01 AM, hoss7 wrote: > i have cakephp 1.3.2 i cant use this: > $this->set(compact($options)); > i fix my "Undefined variable: options" error with this: > $this->set(compact('options')); > > but thank you Sorry about that. I missed the "$" in there. My bad. Check out the

Re: problem select menu with "optgroups"

2010-07-29 Thread hoss7
can you convert $form->select to $form->input in view? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to

Re: problem select menu with "optgroups"

2010-07-29 Thread hoss7
@circket you fix my problem,i have litle problem i need like this: input('field', array('options' => array(1,2,3,4,5), 'empty' => '(choose one)')); ?> use 'empty' => '(choose one)' in echo $form->select('category_id', $options); what i am must to do? Check out the new CakePHP Questions site http

Re: problem select menu with "optgroups"

2010-07-29 Thread hoss7
i have cakephp 1.3.2 i cant use this: $this->set(compact($options)); i fix my "Undefined variable: options" error with this: $this->set(compact('options')); but thank you Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You receive

Re: problem select menu with "optgroups"

2010-07-28 Thread hoss7
i use : function usercat() { $usercats = $this->Subcat->Cat->find('all'); $options = array(); foreach($usercats as $k => $v) { $cat_name = $v['Cat']['title']; $options[$cat_name] = array(); foreach($v['Subcat'] as $sub_cat) {

Re: problem select menu with "optgroups"

2010-07-28 Thread cricket
$this->set(compact($options)); On Wed, Jul 28, 2010 at 4:29 PM, hoss7 wrote: > i am test you code @circket but i have error: > > Undefined variable: options > > i use you code like this: > in view: > echo $form->select('category_id', $options); > > in SubcatsController: > function usercat() { >  

Re: problem select menu with "optgroups"

2010-07-28 Thread hoss7
i am test you code @circket but i have error: Undefined variable: options i use you code like this: in view: echo $form->select('category_id', $options); in SubcatsController: function usercat() { $usercats = $this->Subcat->Cat->find('all'); $options = array(); f

Re: problem select menu with "optgroups"

2010-07-28 Thread hoss7
this is sql: -- Table structure for table `cats` -- CREATE TABLE IF NOT EXISTS `cats` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8_persian_ci NOT NULL, `status` int(2) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLA

Re: problem select menu with "optgroups"

2010-07-28 Thread cricket
On Wed, Jul 28, 2010 at 1:41 PM, hoss7 wrote: > cricket how can i pass this array? (i am new in cakephp) > echo $form->select('category_id', $options); I'm assuming here that the name should be 'category_id'. You'll need to get the array into the proper format. You can probably do that with the

Re: problem select menu with "optgroups"

2010-07-28 Thread Norman Paniagua
Try, in the controller $this->set('selectOptions', $arrayWithOptions); In the view $form->input('select_option'); For more information see http://book.cakephp.org/view/1390/Automagic-Form-Elements --- Norman Paniagua 2010/7/28 hoss7 > cricket how can i pass this array? (i am new in cakephp

Re: problem select menu with "optgroups"

2010-07-28 Thread hoss7
cricket how can i pass this array? (i am new in cakephp) can you show me? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this

Re: problem select menu with "optgroups"

2010-07-28 Thread cricket
On Tue, Jul 27, 2010 at 1:41 PM, hoss7 wrote: > > i want create select menu with "optgroups" like this: > >         >                         >                                sub1-1 >                         >                                 >                                sub2-1 >              

Re: problem select menu with "optgroups"

2010-07-28 Thread hoss7
i use $form->input but i cant create best 'options'=>$arrayValues for that input. my field name is usercats and i have this: $form->input('usercats') and in SubcatsController i have: $usercats = $this->Subcat->Cat->find('all'); $this->set(compact('usercats')); i can load all dat

Re: problem select menu with "optgroups"

2010-07-27 Thread Norman Paniagua
Try with $form->input('FieldName'); or $form->input('FieldName', array('options'=>$arrayValues)); --- Norman Paniagua 2010/7/27 hoss7 > i have this array: > > Array > ( >[0] => Array >( >[Cat] => Array >( >[id] => 1 >

problem select menu with "optgroups"

2010-07-27 Thread hoss7
i have this array: Array ( [0] => Array ( [Cat] => Array ( [id] => 1 [title] => cat1 [status] => 1 ) [Subcat] => Array ( [0] => Array