Hi, I wonder if you always use form help? or in some cases you make your form.
I sometimes struggle to use form helper with many-to-many association.
Thank you
Hi, I wonder if you always use form help? or in some cases you make your form.
I sometimes struggle to use form helper with many-to-many association.
Thank you
Yes, I always use the form helper. Can you give an example of an input you have not been able to accomplish using the helper, but you can do if you make it yourself?
Actually I’m just asking for everyone’s opinion. I am getting started with frameworks so it may be a bit challenging to understand all conventions like many-to-many association. Could you please explain this a little bit for me:
echo $this->Form->control('groups._ids', ['options' => $groups]);
This would be to create the interface for selecting a number of groups from the provided list of options. When you patch your entity with the resulting data, it’ll have a “groups” property, which will be an array consisting of entities with the selected IDs. Saving that will “link” all those groups to the entity in question, in a many-to-many relationship.
Thank you for such a detailed explanation. This question may not be relevant but I wonder how I can echo information from Model/Table/ArticlesTable.php . I have some logic here but I want to test it by see it in the view.
Thanks again
A new question should be asked as a new question, not tacked onto the end of another one. When you ask that, be sure to clarify what you mean by “echo information from Model/Table/ArticlesTable.php”, include any code that clarifies things for whoever is reading. Because right now, I can think of probably 3 different things this may mean.
Thank you. I will do
<?= $this->Form->create('', ['type' => 'file', 'id' => 'frmm']); ?>
// all required form field in html & php
<?= $this->Form->end(); ?>
This 2 line required in cakephp for default csrf validation on form submit.
So I’m using this much of Form helper.
If you ever want to use the form security component, you’ll need to use the form helper much more extensively than this.