# |
Jul 12th 2018, 13:21 |
flavius |
``` // disable backend submit buttons to avoid duplicates $('form').submit(function() { var b = $('[type=submit]', this); b.attr('disabled', 'disabled'); b.html('Vă rugăm așteptați...'); }); ``` |
# |
Jul 12th 2018, 13:20 |
admad |
google gave me this https://github.com/solarmosaic/jquery-prevent-double-submit |
# |
Jul 12th 2018, 13:20 |
dereuromark |
I just tested the posted JS script, and for me it works perfectly :slightly_smiling_face: Gonna use it now. thx! |
# |
Jul 12th 2018, 13:20 |
flavius |
had the same problem, resolved with some simple js :slightly_smiling_face: |
# |
Jul 12th 2018, 13:20 |
dereuromark |
As for dup rows: where are your table db constraints and cake validation? That shouldnt happen but error out beforehand. |
# |
Jul 12th 2018, 13:19 |
dereuromark |
rogerpro: Sec. component, yeah. But with some JS additions it seems to be fine to use in newer cake versions. |
# |
Jul 12th 2018, 13:10 |
admad |
nothing needs to be done in PHP code |
# |
Jul 12th 2018, 13:10 |
admad |
so add your JS to disable the button |
# |
Jul 12th 2018, 13:09 |
rogerpro |
mmm @admad most customers don’t like duplicated rows in their databases :slightly_smiling_face: |
# |
Jul 12th 2018, 13:08 |
rogerpro |
@dereuromark what do you mean in “That’s why I usually don’t use it much.” SecurityComponent? JS? https://github.com/cakephp/cakephp/issues/12347#issuecomment-404487006 |
# |
Jul 12th 2018, 13:08 |
admad |
i don't do anything :slightly_smiling_face: |
# |
Jul 12th 2018, 13:07 |
rogerpro |
@admad about https://github.com/cakephp/cakephp/issues/12347#issuecomment-404505212 you mean that you manage a duplicator detector in your apps? |
# |
Jul 12th 2018, 13:02 |
admad |
sorry the last wicket wasnt to part timer, i misread |
# |
Jul 12th 2018, 13:00 |
admad |
@josbeir hehe |
# |
Jul 12th 2018, 13:00 |
admad |
And new they gift a wicket even to a part time spinner :P |
# |
Jul 12th 2018, 13:00 |
josbeir |
:) |
# |
Jul 12th 2018, 13:00 |
josbeir |
@admad knows abour cricket, definatly india now |
# |
Jul 12th 2018, 12:54 |
neon1024 |
Shambolic. |
# |
Jul 12th 2018, 12:54 |
neon1024 |
https://www.bbc.co.uk/sport/cricket/scorecard/ECKO42913 |
# |
Jul 12th 2018, 12:53 |
ricksaccous |
yeah bro i could have made you a burrito right here with guac, beans, and sour cream |
# |
Jul 12th 2018, 12:52 |
neon1024 |
It was a mistake to queue for burritos |
# |
Jul 12th 2018, 12:52 |
neon1024 |
Still, they batted better than Hampshire v Glamorgan last week, by the time I’d got food in the mid innings interval we were 4 down |
# |
Jul 12th 2018, 12:51 |
neon1024 |
It’s the stupidity of the dismissals which gall me |
# |
Jul 12th 2018, 12:32 |
admad |
see, 3 gone as soon as spinners came on :) |
# |
Jul 12th 2018, 12:28 |
admad |
@neon1024 it would have been a decent contest if your batsmen knew how to play spin :P |
# |
Jul 12th 2018, 10:58 |
dereuromark |
plus covering some extra cases. |
# |
Jul 12th 2018, 10:58 |
neon1024 |
Ah yeah, you did the same |
# |
Jul 12th 2018, 10:57 |
neon1024 |
File uploaded https://cakesf.slack.com/files/U1BT622HW/FBNQ2928H/conditional_ordering_with_beforefind.php / https://slack-files.com/T053DPNCM-FBNQ2928H-0c0ef167d1 |
# |
Jul 12th 2018, 10:56 |
dereuromark |
yeah, this is way more elegant: https://github.com/dereuromark/cakephp-shim/blob/master/src/Model/Table/Table.php#L369 |
# |
Jul 12th 2018, 10:55 |
neon1024 |
Yeah I might need to go in that direction, as a beforeFind would overwrite any PaginatorHelper query strings |
# |
Jul 12th 2018, 10:55 |
dereuromark |
I just like to use the simple `public $order = ['created' => 'DESC'];` here still :slightly_smiling_face: |
# |
Jul 12th 2018, 10:54 |
hmic |
which makes it possible to get overwritten easily too, whiche beforeFind makes more difficult |
# |
Jul 12th 2018, 10:53 |
neon1024 |
Slick hmic! |
# |
Jul 12th 2018, 10:53 |
neon1024 |
Suppose a beforeFind |
# |
Jul 12th 2018, 10:53 |
hmic |
you can just overwrite the find() method in the table to add to the query object |
# |
Jul 12th 2018, 10:53 |
neon1024 |
A plugin feels a bit overkill |
# |
Jul 12th 2018, 10:53 |
dereuromark |
or steal the idea |
# |
Jul 12th 2018, 10:53 |
dereuromark |
Using shim plugin you can. |
# |
Jul 12th 2018, 10:53 |
neon1024 |
That’s a controller property though right? I’d have to read the Table class property from the controller I guess |
# |
Jul 12th 2018, 10:53 |
dereuromark |
ah, you mean for tables? |
# |
Jul 12th 2018, 10:52 |
dereuromark |
$paginate property can do that |