hi Nate,
The other reason I check for postback is that I populate a table of
data depending upon the choice of the combobox.
This is my entire controller:
===================
function details($id = null)
{
$isPostBack=false;
if (! empty($this->data))
{
$isPostBack=true;
}
// Get the User.
$this->User->id = $id;
// Must use find so that associations are retrieved.
$this->data = $this->User->findByUsergroupid($id);
$this->set('user', $this->data);
//echo pr($this->data);
// Format some fields
$displayName = $this->data['User']['Name'] . ' (' .
$this->data['User']['UserName'] . ')';
$this->set('displayName', $displayName);
// Set the plan name.
$this->set('planName', $this->data['Plan']['name']);
$flatRateText = 'No';
if ($this->data['Plan']['flatRateOnly'])
{
$flatRateText = 'Yes';
}
$overUsageText = 'No';
if ($this->data['User']['overusage'])
{
$overUsageText = 'Yes';
}
$staticIpText = 'No';
if ($this->data['User']['staticIP'])
{
$staticIpText = 'Yes';
}
$this->set('flatRateText', $flatRateText);
$this->set('overUsageText', $overUsageText);
$this->set('staticIpText', $staticIpText);
// Get months to populate dropdown.
$condition = 'firstMonthDate < GetDate()';
$orderBy = 'lastMonthDate desc';
$months = $this->Monthcalendar->findAll($condition,
null,$orderBy);
// echo pr($months);
// Get month list for dropdown.
$monthList = UsersController::buildMonthList($months);
$this->set('months',$monthList);
// If form posted due to month change.
$indexSelected='';
if ($isPostBack) {
// Get value.
//echo pr($this->params['form']);
$indexSelected =
$this->params['form']['data']['User']['firstMonthDate'];
$firstMonthDate =
$months[$indexSelected]['MonthCalendar']['firstMonthDate'];
$lastMonthDate =
$months[$indexSelected]['MonthCalendar']['lastMonthDate'];
}
else
{
// Filter stats to current first month in list.
$firstMonthDate =
$months[0]['MonthCalendar']['firstMonthDate'];
$lastMonthDate =
$months[0]['MonthCalendar']['lastMonthDate'];
}
// This will set the dropdown at selected value.
$this->set('indexSelected',$indexSelected);
$userName = $this->data['User']['UserName'];
$radacctData =
UsersController::getRadAcctData($userName,
$firstMonthDate,$lastMonthDate);
$this->set('radacctData',$radacctData);
}
=====================
Does the combobox code look OK?
pat.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---