Log message #4019965

# At Username Text
# 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
# 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