Have a look at the controller action "add" you are calling. Note the name of the variable being set from the find (or read). At the top of your add.ctp add the line <?php debug($variablenamesetincontroller);? > Relaunch the page again and have a look at the array produced from the find. Then on the line input form options you can set the employees' name with something like $variablenamesetincontroller ['Employee']['name']
On Jan 15, 11:37 am, Guran <[email protected]> wrote: > John; > Thanks for the response. > I am sorry I did not understand. I am a newbee. the code <?php echo > $form->input('employee_id'); ?> generated by cake produces a drop down > of all employee names in the database. > Instead I want to present only the name of the logged in employee > since the expense statement will be filed under the employees name/id. > I believe there will be a hidden field but there will also be some > kind of label that will show the employee name. I don't know how to > put this together. > ...guran > > On Jan 15, 1:46 pm, John Andersen <[email protected]> wrote: > > > Can the employee choose another employee id in the select list? If the > > employee is not allowed to choose another employee id, then just show > > the existing employee id as a label, not a list. > > > For preselecting the employees id in the select list, add the > > employees id to the controllers data variable, example: > > > [code] > > $this->data['Employee']['id'] = $this->Auth->user('employee_id'); > > [/code] > > Replace the respective parts according to your data structures. > > > Enjoy, > > John > > > On Jan 15, 8:37 pm, Guran <[email protected]> wrote: > > > > I am building a expense submitter system. I have employees who have a > > > "name field" and an "employee_id field". > > > In the view - views/expenses/add.ctp Cake has generated the following > > > code: > > > <?php echo $form->input('employee_id'); ?>. This results in a select/ > > > option drop down listing all the employees. > > > Through a login process I have an employee_id. I would like the field > > > employee name to be the name of the current logged in employee that > > > will be a part of the submit when I hit the submit button. > > > as against the whole list. I have tried various approaches without any > > > success. Any help is appreciated. > > > thanks > > > /guran
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 [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?hl=en
