Thursday, January 29, 2009

Re: how to get value from select drop down box

Hi vikas,

Getting the value works no different than the value of a normal text
input field.
The controller sees
this->data['Model']['report_timeframe'] // or whatever you call it.

The options array you pass to the select field looks like this:
array(
'value' => 'visible label'
)
So I usually format it this way:
array(
'month' => 'By Month',
'quarter' => 'By Quarter',
...
)
That way I have a readable value in the controller "month" instead of
a number "0" and a nice formatted textual representation for the user
(which can be translated).


On Jan 29, 2:45 pm, vikas <vikas...@gmail.com> wrote:
> Hello all..
>
> bit confused..
>
> I have report generation option in my application.
>
> In that I want to generate attendnace report by month, by quarter etc.
>
> So I would like to put select dropdown box where there is options like
> ByMonth,ByQuarte, etc.. User selects the option and see the report..
>
> So how can I do this?? I have created the function that filters the
> record according to condition.. But how I will check which option is
> selected by user for the report from select drop down box as it is in
> the view file..
>
> please help me out..
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: