# |
Sep 21st 2019, 08:57 |
adam282 |
Um, view the source and you should see a hidden field |
# |
Sep 21st 2019, 08:57 |
destinydriven |
its returning <%= key %> instead of the value |
# |
Sep 21st 2019, 08:57 |
adam282 |
What do you mean by properly process? |
# |
Sep 21st 2019, 08:56 |
destinydriven |
In Cake2 is there any way to get FormHelper is properly process a template variable like $key : ‘<%= key %>’; echo $this->Form->hidden(“DailyHour.{$i}.employee_id”, [‘value’ => “{$key}“, ‘id’ => false]); |
# |
Sep 21st 2019, 08:46 |
adam282 |
Oh, and one Authors Controller, if needed. |
# |
Sep 21st 2019, 08:46 |
adam282 |
One Authors table, one Authors model, one Author Entity… |
# |
Sep 21st 2019, 08:46 |
adam282 |
Then why would you need a prefix? |
# |
Sep 21st 2019, 08:45 |
jotpe |
For now, they don't. |
# |
Sep 21st 2019, 08:42 |
adam282 |
Hm, do the other plugins contain the same tables? If so, you really should rethink your structure. |
# |
Sep 21st 2019, 08:41 |
jotpe |
I guess I'll just change the setTable() in my Model. |
# |
Sep 21st 2019, 08:40 |
jotpe |
I mean: In my db it could get messy if I have authors, speakers etc. and this is just for one plugin (I have 20 more to migrate). Would be good to have db tables like cfp_authors but in my Application have just a Authors Model. |
# |
Sep 21st 2019, 08:37 |
adam282 |
Well, a table prefix would apply to the entire app and all tables. |
# |
Sep 21st 2019, 08:36 |
jotpe |
Is there something like a table prefix? Since I have a lots of models I want to group them to the corresponding plugin. |
# |
Sep 21st 2019, 08:25 |
adam282 |
You’re very welcome |
# |
Sep 21st 2019, 08:24 |
jotpe |
This was lots of help :slightly_smiling_face: |
# |
Sep 21st 2019, 08:24 |
jotpe |
Okay, thanks so much :slightly_smiling_face: |
# |
Sep 21st 2019, 08:23 |
adam282 |
Well, I am out of suggestions then. Sorry bud |
# |
Sep 21st 2019, 08:23 |
adam282 |
Oh, I see. |
# |
Sep 21st 2019, 08:22 |
jotpe |
I guess it's a bit of a requirement to readd them. I can't expose a list of authors, since this will be publicly available. Also people should have different organizations, not just one. Also the db data is truncated once a year. |
# |
Sep 21st 2019, 08:20 |
adam282 |
On the add talk page, provide a drop down of the current people (you can have three different lists if need be) and next to it put a plus button. Let the user choose the person from the list and click the button to actually add that user to the talk (maybe by way of AJAX?). Then, put another button that opens a modal window to add someone not already in the database. |
# |
Sep 21st 2019, 08:19 |
jotpe |
comments will be users, so in this case saving the Authors didn't work |
# |
Sep 21st 2019, 08:19 |
adam282 |
That’s not really a good idea. It will make the database grow and be unorganized and have multiple duplicates. There’s a much better way to do this and that is with associations. |
# |
Sep 21st 2019, 08:19 |
jotpe |
https://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities |
# |
Sep 21st 2019, 08:19 |
jotpe |
My request data looks something like this |
# |
Sep 21st 2019, 08:19 |
jotpe |
So i just readd them |
# |
Sep 21st 2019, 08:19 |
jotpe |
Yes, people can have different organization affiliations. |
# |
Sep 21st 2019, 08:18 |
adam282 |
Okay, but what if you have a new talk and a person already exists in the database table? You’re going to add them again? |
# |
Sep 21st 2019, 08:18 |
jotpe |
yes |
# |
Sep 21st 2019, 08:18 |
adam282 |
Like first name, last name, etc? |
# |
Sep 21st 2019, 08:18 |
jotpe |
yes |
# |
Sep 21st 2019, 08:17 |
adam282 |
Okay, so there are fields? |
# |
Sep 21st 2019, 08:17 |
jotpe |
The author is added in that form, not from a list. To add a author no new view is rendered. It's just the same form. |
# |
Sep 21st 2019, 08:16 |
adam282 |
No problem. I am learning CakePHP 3.x so I feel your pain. |
# |
Sep 21st 2019, 08:15 |
jotpe |
Thanks for your help! ;) I'm just learning |
# |
Sep 21st 2019, 08:15 |
adam282 |
Sorry if I am not being of much help. |
# |
Sep 21st 2019, 08:15 |
adam282 |
So either use a button to add a new person or a drop down with an auto select or something. |
# |
Sep 21st 2019, 08:14 |
adam282 |
Okay, so that’s easy. |
# |
Sep 21st 2019, 08:14 |
adam282 |
When submitted, provided the data is formatted properly and the associations are set up in the model, it should just work. |
# |
Sep 21st 2019, 08:14 |
jotpe |
There's on form to add a talk, within this form you can add Authors, Speakers, ... |
# |
Sep 21st 2019, 08:14 |
adam282 |
So, in one of my apps I have an option for a subscription to be part of multiple distribution lists. To select distribution lists, there’s a multiple select box: ``` <?php echo $this->Form->input('DistributionList', array('type' => 'select', 'empty' => false, 'options' => $lists, 'class' => 'form-control selectpicker', 'id' => 'distribution_list', 'multiple' => true, 'size' => '10')); ?> ``` |
# |
Sep 21st 2019, 08:13 |
adam282 |
Hm, I don’t quite understand. |