Do as I told you in my previous message: input('related_propery.field')
On Tuesday, August 5, 2014 11:19:29 AM UTC+2, Jipson Thomas wrote:
>
> Hi Jose,
> Sorry. What I said in my last thread that I re created my models ,views
> and controllers through bake (The code I pasted in an older thread was not
> from bake command.). The form created through bake doesn't include the user
> table inputs. I will paste the code of form generated through bake below.
> ===========
>
> <div class="vendors form">
> <?= $this->Form->create($vendor); ?>
> <fieldset>
> <legend><?= __('Add Vendor'); ?></legend>
> <?php
> echo $this->Form->input('company_name');
> echo $this->Form->input('logo_url');
> echo $this->Form->input('email_domain');
> echo $this->Form->input('phone');
> echo $this->Form->input('fax');
> echo $this->Form->input('website');
> echo $this->Form->input('address');
> echo $this->Form->input('country');
> echo $this->Form->input('city');
> echo $this->Form->input('state');
> echo $this->Form->input('postalcode');
> echo $this->Form->input('subscription_package');
> echo $this->Form->input('status');
> echo $this->Form->input('no_emails');
> echo $this->Form->input('no_partners');
> echo $this->Form->input('coupon_id');
> echo $this->Form->input('language');
> ?>
> </fieldset>
> <?= $this->Form->button(__('Submit')); ?>
> <?= $this->Form->end(); ?>
> </div>
> <div class="actions">
> <h3><?= __('Actions'); ?></h3>
> <ul>
> <li><?= $this->Html->link(__('List Vendors'), ['action' =>
> 'index']); ?></li>
> <li><?= $this->Html->link(__('List Coupons'), ['controller' =>
> 'Coupons', 'action' => 'index']); ?> </li>
> <li><?= $this->Html->link(__('New Coupon'), ['controller' =>
> 'Coupons', 'action' => 'add']); ?> </li>
> <li><?= $this->Html->link(__('List Partners'), ['controller' =>
> 'Partners', 'action' => 'index']); ?> </li>
> <li><?= $this->Html->link(__('New Partner'), ['controller' =>
> 'Partners', 'action' => 'add']); ?> </li>
> <li><?= $this->Html->link(__('List VendorManagers'), ['controller'
> => 'VendorManagers', 'action' => 'index']); ?> </li>
> <li><?= $this->Html->link(__('New Vendor Manager'), ['controller'
> => 'VendorManagers', 'action' => 'add']); ?> </li>
> </ul>
> </div>
>
> ==========
>
> The above code is to create separate forms for each table. My requirement
> is to make a single signup form for all the 3 tables.
>
> Apologize to be a continuing burdan...
>
> Regards,
> Jipson
>
>
> On Tuesday, 5 August 2014 10:11:36 UTC+1, José Lorenzo wrote:
>>
>> I find hard to believe that the form you showed above was generated by
>> bake, but I can definitely look if there is any errors in the bake tool.
>> The reason I say that is that we are not using the 'UppercaseThing.field'
>> notation anymore, we use lowercase properties.
>> For example if Articles belongsTo Authors the form would look like:
>>
>> <?php echo $this->Form->input('title') ?>
>> <?php echo $this->Form->input('author.name') ?>
>> <?php echo $this->Form->input('author.email') ?>
>>
>> On Tuesday, August 5, 2014 10:48:56 AM UTC+2, Jipson Thomas wrote:
>>>
>>> Hi Jose,
>>> Yes , I did the controller, model and view creation through the bake
>>> console. But it is not helping me to save data from single form to multiple
>>> tables. In my case the vendor signup form is having the input fields to
>>> vendor table, vendor manager table and a user table. Would you please help
>>> me to find a solution on this?
>>>
>>> Regards,
>>> Jipson
>>>
>>> On Monday, 4 August 2014 18:26:48 UTC+1, José Lorenzo wrote:
>>>>
>>>> I would recommend that you use the bake console tool to create the
>>>> initial controller code and forms, that way I'm sure you will learn and
>>>> understand how forms should be structured.
>>>>
>>>> On Monday, August 4, 2014 5:46:29 PM UTC+2, Jipson Thomas wrote:
>>>>>
>>>>> Hi,
>>>>> When I change the controller code as follows, It saves in vendor table
>>>>> only and return a true value.
>>>>>
>>>>> $vendors = TableRegistry::get('Vendors');
>>>>>
>>>>> if ($this->request->is('post')) {
>>>>> $vendor = new Vendor($this->request->data['Vendor']);
>>>>> $vendor->VendorManagers = [
>>>>> new
>>>>> VendorManager($this->request->data['VendorManager']),
>>>>> ];
>>>>> $vendor->Users = [
>>>>> new User($this->request->data['User']),
>>>>> ];
>>>>> //print_r($vendor);
>>>>> if ($vendors->save($vendor)) {
>>>>> $this->Flash->success(__('The vendor has been saved'));
>>>>> return $this->redirect(['action' => 'index']);
>>>>> }
>>>>> $this->Flash->error(__('Unable to add the vendor'));
>>>>> }
>>>>> $this->set('vendor', $vendor);
>>>>> $this->set('subscription_package', $id);
>>>>> $this->set('subscription_type', $payoption);
>>>>>
>>>>> On Monday, 4 August 2014 16:17:10 UTC+1, Jipson Thomas wrote:
>>>>>>
>>>>>> The save method is returning a false only not any error messages.
>>>>>>
>>>>>> On Monday, 4 August 2014 14:43:20 UTC+1, Jipson Thomas wrote:
>>>>>>>
>>>>>>> Hi All,
>>>>>>> Would you please give me some details or samples of saving data from
>>>>>>> a single form to the tables main and has many relationships. I tries
>>>>>>> with
>>>>>>> the normal way by adding a modelname.fieldname on form and the sual
>>>>>>> newentity of main table but it through false on save(); Please help me
>>>>>>> to
>>>>>>> fix this
>>>>>>>
>>>>>>> Regards,
>>>>>>> Jipson
>>>>>>>
>>>>>>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.