# |
Apr 25th 2017, 09:19 |
hagen00 |
i.e. radio... |
# |
Apr 25th 2017, 09:19 |
hagen00 |
must be editable though |
# |
Apr 25th 2017, 09:18 |
dereuromark |
most people wouldnt even use a radio here, just directly output icon + value |
# |
Apr 25th 2017, 09:18 |
hagen00 |
that works, but it's ugly |
# |
Apr 25th 2017, 09:18 |
dereuromark |
value= $entity->value |
# |
Apr 25th 2017, 09:18 |
hagen00 |
echo $this->Form->radio( 'profile_category_questions._ids', [ ['value' => 'r', 'text' => 'Red', 'style' => 'color:red;'], ['value' => 'u', 'text' => 'Blue', 'style' => 'color:blue;', 'checked' => 'checked'], ['value' => 'g', 'text' => 'Green', 'style' => 'color:green;'], ] ); |
# |
Apr 25th 2017, 09:18 |
hagen00 |
maybe this: |
# |
Apr 25th 2017, 09:18 |
dereuromark |
wuut? but then you can directly use entities? |
# |
Apr 25th 2017, 09:18 |
hagen00 |
i have no problems with any of the controller things... |
# |
Apr 25th 2017, 09:18 |
dereuromark |
and with cake3 even entities to do the same thing even cleaner |
# |
Apr 25th 2017, 09:18 |
hagen00 |
ok, will look, but to be clear, i'm in the view .ctp file... |
# |
Apr 25th 2017, 09:17 |
dereuromark |
there is an else case for if(posted) |
# |
Apr 25th 2017, 09:17 |
dereuromark |
It works like it did 7 years ago :slightly_smiling_face: http://www.dereuromark.de/2010/06/23/working-with-forms/#default-values |
# |
Apr 25th 2017, 09:16 |
dereuromark |
my point exactly |
# |
Apr 25th 2017, 09:16 |
hagen00 |
i..e i'm landing on the page, requeste->data not set yet. no post request yet |
# |
Apr 25th 2017, 09:16 |
hagen00 |
yes, i know that for simple forms. not sure it will work for a complex form, with multiple associations... |
# |
Apr 25th 2017, 09:16 |
hagen00 |
hmm, but my array isn't populated from request->data. |
# |
Apr 25th 2017, 09:15 |
dereuromark |
you can also populate the entity and do form->create($entity) - will also work and is even cleaner |
# |
Apr 25th 2017, 09:15 |
dereuromark |
yes, and what I said is for displaying the selected value |
# |
Apr 25th 2017, 09:14 |
dereuromark |
but I wouldnt do this with magic numbers, use either string keys, or better like I do a enum kind of approach |
# |
Apr 25th 2017, 09:14 |
hagen00 |
i.e the form has been saved, now i want to display it again |
# |
Apr 25th 2017, 09:14 |
hagen00 |
i'm asking for display purposes. not saving purposes |
# |
Apr 25th 2017, 09:14 |
dereuromark |
it is really that easy |
# |
Apr 25th 2017, 09:14 |
dereuromark |
$this->request->data[gender] = number |
# |
Apr 25th 2017, 09:13 |
dereuromark |
if it is provided in the correct form |
# |
Apr 25th 2017, 09:13 |
hagen00 |
how do i set Feminime to checked? |
# |
Apr 25th 2017, 09:13 |
hagen00 |
so for example: $this->Form->radio('gender', ['Masculine','Feminine','Neuter']); |
# |
Apr 25th 2017, 09:13 |
dereuromark |
why? it reads the data |
# |
Apr 25th 2017, 09:13 |
hagen00 |
yes, i have the data. the data isn't the problem. the problem is the helper... |
# |
Apr 25th 2017, 09:13 |
dereuromark |
either from controller via request->data preset, or in view via default |
# |
Apr 25th 2017, 09:12 |
hagen00 |
https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-radio-buttons |
# |
Apr 25th 2017, 09:12 |
hagen00 |
Can anyone advise how to set a radio button to checked in a radio button list. The docs aren't clear on this. |
# |
Apr 25th 2017, 08:59 |
digitalfotografen |
Thanks for a great plugin!!! I use it for stuff where You probably should use a more "professional" queue handler. But nu keeping it inside Cake simplifies installations. |
# |
Apr 25th 2017, 08:56 |
dereuromark |
thx for the feedback guys, I tagged 3.4.0 |
# |
Apr 25th 2017, 08:55 |
digitalfotografen |
@dereuromark @birdy247 I have been using dev dev-master of Queue on CakePHP 3.3 and 3.4 for some time. It has been stable. I works great! |
# |
Apr 25th 2017, 08:45 |
ashish_onmobile |
@birdy247 |
# |
Apr 25th 2017, 08:45 |
ashish_onmobile |
let me know if it fit to your need. |
# |
Apr 25th 2017, 08:45 |
ashish_onmobile |
whatever table you want to use. |
# |
Apr 25th 2017, 08:45 |
ashish_onmobile |
try like this inside contain |
# |
Apr 25th 2017, 08:45 |
ashish_onmobile |
‘Users’ => function ($q) { |
# |
Apr 25th 2017, 08:43 |
birdy247 |
@dereuromark yes seems solid to me |