cake-php@googlegroups.com
[Top] [All Lists]

Re: Form input selected

Subject: Re: Form input selected
From: heohni
Date: Sat, 25 Feb 2012 00:59:15 -0800 PST
Hi Mark!

What do you mean by "passing it on to the view via $this->request-
>data"?
Can you please give me an example?

On 25 Feb., 01:10, euromark <dereurom...@xxxxxxxxxxxxxx> wrote:
> yes you should never use those named params without checking for them
> first
>
> and - I would put the logic in the controller
> passing it on to the view via $this->request->data
> thats a cleaner approach than using the form here for the selected
> value
>
> On 24 Feb., 20:51, heohni <heidi.anselstet...@xxxxxxxxxxxxxxxxx>
> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I am using the ajax pagination and my url looks like this:
> > /search/cat:12/city:67/sleeps:1/price:2
>
> > I have for each a dropdown input select:
> > $this->Form->input('cat', array('options' => $getCategories,
> > 'selected' => $this->request->params['named']['cat']));
>
> > But what I want to know, what is best practice, because on first call
> > of the form and their input selects I get the error:
> > Undefined index: cat
>
> > Which is clear for me, but do I have really to check before is the
> > value is present? Like
> > $selectedCat = 
> > ($this->request->params['named']['cat'])?$this->request->params['named']['c­at']:'';
>
> > echo $this->Form->input('cat', array('options' => $getCategories,
> > 'selected' => $selectedCat));
>
> > Is this best practice?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php

<Prev in Thread] Current Thread [Next in Thread>