# |
Feb 11th 2018, 04:57 |
humbba12 |
oh thanks for sharing the code snippet :) |
# |
Feb 11th 2018, 04:56 |
ricksaccous |
no problem ;) |
# |
Feb 11th 2018, 04:56 |
ricksaccous |
not perfect |
# |
Feb 11th 2018, 04:56 |
ricksaccous |
File uploaded https://cakesf.slack.com/files/U8LQ47EPR/F98A9D4R5/my_solution_for_this_type_of_thing.js / https://slack-files.com/T053DPNCM-F98A9D4R5-86fb52d941 |
# |
Feb 11th 2018, 04:55 |
humbba12 |
thanks for your help |
# |
Feb 11th 2018, 04:55 |
humbba12 |
I am |
# |
Feb 11th 2018, 04:55 |
humbba12 |
I really thankfull |
# |
Feb 11th 2018, 04:55 |
humbba12 |
Yeah i can do it from here |
# |
Feb 11th 2018, 04:54 |
ricksaccous |
hahaha |
# |
Feb 11th 2018, 04:54 |
ricksaccous |
sorry dude you're on your own there |
# |
Feb 11th 2018, 04:54 |
humbba12 |
:rolling_on_the_floor_laughing: |
# |
Feb 11th 2018, 04:54 |
ricksaccous |
jesus christ, lol |
# |
Feb 11th 2018, 04:53 |
humbba12 |
File uploaded https://cakesf.slack.com/files/U6DMU08AE/F96MW909F/-.js / https://slack-files.com/T053DPNCM-F96MW909F-0058a331d5 - it is not finished |
# |
Feb 11th 2018, 04:53 |
ricksaccous |
and remember how many items you have |
# |
Feb 11th 2018, 04:53 |
ricksaccous |
for new items |
# |
Feb 11th 2018, 04:53 |
ricksaccous |
yeah so you will have to set the name parameter with javascript then |
# |
Feb 11th 2018, 04:53 |
humbba12 |
yes |
# |
Feb 11th 2018, 04:53 |
ricksaccous |
you mean so you add more options and delete options? |
# |
Feb 11th 2018, 04:52 |
humbba12 |
let me show you |
# |
Feb 11th 2018, 04:52 |
humbba12 |
the issue here is that it must be a dynamic form so I used javascript |
# |
Feb 11th 2018, 04:52 |
ricksaccous |
just play around with it and look at the data structure until you get it right, heh |
# |
Feb 11th 2018, 04:52 |
ricksaccous |
<?= $this->Form->control('Options.0.name'); ?> or whatever |
# |
Feb 11th 2018, 04:51 |
ricksaccous |
each option should be |
# |
Feb 11th 2018, 04:51 |
ricksaccous |
depends how you have your form set up |
# |
Feb 11th 2018, 04:51 |
humbba12 |
like in function new ? |
# |
Feb 11th 2018, 04:51 |
humbba12 |
but it is gonna work with getting from post |
# |
Feb 11th 2018, 04:51 |
ricksaccous |
sheeeeeet |
# |
Feb 11th 2018, 04:51 |
ricksaccous |
yeah those array structures always need to be precise |
# |
Feb 11th 2018, 04:51 |
humbba12 |
It worked :) |
# |
Feb 11th 2018, 04:50 |
ricksaccous |
;) |
# |
Feb 11th 2018, 04:49 |
ricksaccous |
what you have now is just 'options' => ['name' => 'dude'] which is wrong |
# |
Feb 11th 2018, 04:49 |
ricksaccous |
that's how it should be |
# |
Feb 11th 2018, 04:49 |
ricksaccous |
'options' => [ ['name' => 'wow']] |
# |
Feb 11th 2018, 04:49 |
ricksaccous |
in the data |
# |
Feb 11th 2018, 04:48 |
ricksaccous |
you have that set up wrong |
# |
Feb 11th 2018, 04:48 |
ricksaccous |
options has to be an array of arrays |
# |
Feb 11th 2018, 04:48 |
ricksaccous |
wait a minute |
# |
Feb 11th 2018, 04:47 |
ricksaccous |
$item = $this->Items->patchEntity($item, $data,[ 'associated' => ['Groups.Options']]); |
# |
Feb 11th 2018, 04:47 |
ricksaccous |
try using dot notation here instead |
# |
Feb 11th 2018, 04:44 |
ricksaccous |
hmmm |
# |
Feb 11th 2018, 04:44 |
ricksaccous |
oh |