Hi All,
In order to learn cake I created a simple database to model invoices
It has three tables
clients -> hasMany -> invoices -> hasMany -> lineitems
I then used cake bake to create a starting app.
When viewing an Invoice it automatically displays the related
LineItems as expected. Then under that there is a button (link) to add
a new lineitem.
When you click this the add form shows but with a drop down box for
invoice_id. I am trying to change this because I want it to pass the
invoice_id of the currently viewed invoice and pre-fill that field.
I have successfully passed the invoice_id to the
Invoicecontroller::add method through the url query.
The problem is trying to do the following....
Get the form to show the invoice_id passed to the controller method as
a read only - non-drop down and to pass that back to the controller
for the save once the user has entered the data.
The formhelper seems to automagically create a dropdown box for;
echo $this->Form->input('invoice_id');
even if I don't send the list of invoices from the controller using;
$invoices = $this->Lineitem->Invoice->find('list');
$this->set(compact('invoices'));
I can't seem to find any documentation or example of someone pre-
filling certain fields to send to the add.ctp view.
Links to examples or any other help would be much appreciated.
Thanks,
Janimal
PS. I come from a background of C++ (strictly OO) applications
development so maybe I am just thinking about this in the wrong way?
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php