Log message #4201463

# At Username Text
# Sep 4th 2019, 05:42 kiwi_11 ea that would be better than dataloss
# Sep 4th 2019, 05:42 kiwi_11 hi all, new to cakephp and have an app i am trying to figure out a fix for. have a form which is being entered into but if the user clicks away the form doesn't warn of data loss. is there a cake way of doing this or a autosave function? add and edit are through different links but if for instance the autosave then redirecterd to the edit ar
# Sep 4th 2019, 04:57 javier.villanueva morning all
# Sep 4th 2019, 04:56 javier.villanueva ty
# Sep 4th 2019, 04:56 slackebot <javier.villanueva>
# Sep 3rd 2019, 20:39 itmpls n/m, just did it with a notEmpty callback
# Sep 3rd 2019, 19:01 itmpls ->requirePresence('foo', function($context) { dd($context); }); never fires
# Sep 3rd 2019, 19:00 itmpls and requirePresence's 2nd param as a function doesn't seem to work?
# Sep 3rd 2019, 18:59 itmpls I don't think I . can rely on that?
# Sep 3rd 2019, 18:59 itmpls since ->add requires the field to have a value
# Sep 3rd 2019, 18:56 itmpls combining them?
# Sep 3rd 2019, 18:56 itmpls + not blank
# Sep 3rd 2019, 18:55 itmpls what's the best way of doing a requirePresence with a condition in 3.7.x?
# Sep 3rd 2019, 16:58 alexdd55976 @javier.villanueva contain + order by in contain + limit 1 in contain
# Sep 3rd 2019, 16:41 javier.villanueva thanks
# Sep 3rd 2019, 16:40 ndm @javier.villanueva For reference https://gist.github.com/ndm2/b417e3fa683a972e295dc0e24ef515e3
# Sep 3rd 2019, 16:40 ndm @villi
# Sep 3rd 2019, 16:29 javier.villanueva ok
# Sep 3rd 2019, 16:28 dereuromark first can mean a lot of things, in terms of order. if you want to keep things simple get them all and then take the first
# Sep 3rd 2019, 16:26 javier.villanueva There are a direct way?
# Sep 3rd 2019, 16:26 javier.villanueva I know that if I use $this->Articles->find('all')->contain('Tags'). I have an array with them, but I want only first
# Sep 3rd 2019, 16:25 javier.villanueva can I get first of belongsToMany? for example Articles + Tags (HABTM) . I have an article id, and I want the first tag. (with find)
# Sep 3rd 2019, 15:34 neon1024 Perhaps I will make that coffee I’ve been putting off
# Sep 3rd 2019, 15:32 neon1024 Perhaps I should read the docs more! :face_palm:
# Sep 3rd 2019, 15:32 ricksaccous ;)
# Sep 3rd 2019, 15:32 ricksaccous nice
# Sep 3rd 2019, 15:32 ricksaccous but if that works why not
# Sep 3rd 2019, 15:32 neon1024 It’s done now
# Sep 3rd 2019, 15:32 ricksaccous lol
# Sep 3rd 2019, 15:32 ricksaccous you don't necessarily need to customize template
# Sep 3rd 2019, 15:31 ricksaccous under the form key
# Sep 3rd 2019, 15:31 slackebot <neon1024>
# Sep 3rd 2019, 15:31 ricksaccous oh it can take form options
# Sep 3rd 2019, 15:31 neon1024 https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-post-buttons
# Sep 3rd 2019, 15:31 ricksaccous i totally forgot that existed
# Sep 3rd 2019, 15:31 ricksaccous ohhhh
# Sep 3rd 2019, 15:30 neon1024 There is no Form->create
# Sep 3rd 2019, 15:30 neon1024 Because @ricksaccous `postButton` is a single call
# Sep 3rd 2019, 15:30 neon1024 Classes will be applied to the `<button>` tag not the `<form>` tag, which is `display:block` in my application
# Sep 3rd 2019, 15:30 ricksaccous why wouldn't you just add a class in form->create
# Sep 3rd 2019, 15:29 ricksaccous that works too