# |
Apr 25th 2017, 14:55 |
julez |
hello |
# |
Apr 25th 2017, 14:46 |
dereuromark |
I bet people can still buy his book - but the message of "dont use a framework" is very dangerous! |
# |
Apr 25th 2017, 14:45 |
dereuromark |
This guy seems to want to make a quick bug telling people that frameworks like Cake are a false sense of security/simplicity. I think he is dead wrong :slightly_smiling_face: https://www.reddit.com/r/PHP/comments/67go6s/a_false_sense_of_simplicity/ Upvote if you agree with my comment :slightly_smiling_face: |
# |
Apr 25th 2017, 14:07 |
birdy247 |
ah I got it |
# |
Apr 25th 2017, 14:04 |
birdy247 |
I am wondering how I can use formatResults on a query |
# |
Apr 25th 2017, 14:03 |
birdy247 |
I am using crud for the first time |
# |
Apr 25th 2017, 14:01 |
kaliel |
hey everyone, is that possible to loadModel in a Task ? |
# |
Apr 25th 2017, 13:55 |
dereuromark |
Did anyone have an issue with importing exported JSON date back into the DB and datetime? "Invalid datetime format: 1292 Incorrect datetime value: '2017-04-05T17:18:00+00:00' for column 'created' at row 1" |
# |
Apr 25th 2017, 09:24 |
hagen00 |
thanks for the help! |
# |
Apr 25th 2017, 09:24 |
hagen00 |
echo $this->Form->radio( 'profile_category_questions._ids', $all_questions_list, ['default' => 14] ); |
# |
Apr 25th 2017, 09:24 |
hagen00 |
so this works |
# |
Apr 25th 2017, 09:24 |
hagen00 |
ok, sorry @dereuromark it's literally the word "default", like you said. i misread |
# |
Apr 25th 2017, 09:21 |
hagen00 |
yes, ok. will check |
# |
Apr 25th 2017, 09:21 |
dereuromark |
why should this have to be repeated per type? |
# |
Apr 25th 2017, 09:20 |
dereuromark |
well, it is a generic cake basic, any field not just radios work the way I described above. |
# |
Apr 25th 2017, 09:20 |
hagen00 |
so maybe that should e updated... |
# |
Apr 25th 2017, 09:20 |
hagen00 |
don't say anything about setting a value to checked for radio |
# |
Apr 25th 2017, 09:20 |
hagen00 |
but, just a final word on this. the docs here: https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-radio-buttons |
# |
Apr 25th 2017, 09:20 |
neon1024 |
Morning everyone |
# |
Apr 25th 2017, 09:19 |
hagen00 |
will fiddle. not your problem to solve! |
# |
Apr 25th 2017, 09:19 |
hagen00 |
ok thanks :slightly_smiling_face: |
# |
Apr 25th 2017, 09:19 |
dereuromark |
oh geeze :slightly_smiling_face: then use what I said above. |
# |
Apr 25th 2017, 09:19 |
hagen00 |
it's an edit form |
# |
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 |