I have made an element name attendance.thtml, and its working great. I
want to see this element in every page so i have added it in a
default.ctp file.
In this element i have added one select dropdown box for viewing
report (note: initially I have also problem with getting value from
this dropdown box but now it is solved :) ). According to selection
the page is transfer using following code:
function createReport($id=null)
{
if($this->data['Attendance']['reportType'] == 'work_report') {
$this->layout = 'work_report';
$this->set('attendances',$this->Attendance->find('all',array(
'conditions'=>(array(
'Attendance.user_id'=>$this->Session->read
('Auth.User.id'),
'Attendance.date >'=>'2009-01-25'
)
),
'fields'=>(array(
'Attendance.id','Attendance.date','Attendance.timein','Attendance.timeout','Attendance.is_present','Attendance.user_id')
)
)
)
);
}
else if($this->data['Attendance']['reportType'] == 'attendance'){
$this->layout = 'attendance_report';
$this->set('attendances',$this->Attendance->find('all',array(
'conditions'=>(array(
'Attendance.user_id'=>$this->Session->read
('Auth.User.id')
)
),
'fields'=>(array(
'Attendance.id','Attendance.date','Attendance.timein','Attendance.timeout','Attendance.is_present','Attendance.user_id')
)
)
)
);
}
else {
$this->Session->setFlash('Please select option from select box!',
true,array('class' => 'Err'));
}
}
*****************************************
I have created layout for each select option.
that is also working..
now I want functionality that when user has not selected any value
from dropdown and clicked on Go button, message will display to select
the option.. and also he or she must remain on a same page as was
before clicking on a GO button..
that message display portion is done. but user is redirected for the
view file called:
"..attendances/createReport."
But i havent made this view file because i used layout file for other
options, and that is working.
So what to do if i want to disply meassage and also user stays on the
same page as he was before clicking GO button??
need to use routing?? or othe option??
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:
Post a Comment