gpt4 book ai didi

CakePHP 3 : change order in dateWidget

转载 作者:行者123 更新时间:2023-12-01 14:28:27 24 4
gpt4 key购买 nike

我在 the CakePHP developer's guide 上找到了以下提示有关如何在使用 date 表单输入时调整字段的顺序。它说

To control the order of inputs, and any elements/content between the inputs you can override the dateWidget template.

但是,我无法在任何地方找到有关如何更改顺序并在 View 中使用它的提示。你能给点提示吗?

最佳答案

你可以在初始化Form helper的时候配置DateWidget模板

// in MyController.initialize()
$this->loadHelper('Form', [
'dateWidget' => '{{year}}{{month}}{{day}}{{hour}}{{minute}}{{second}}{{meridian}}'
]);

或者您可以使用表单组件中的templates 函数覆盖模板

$this->Form->templates([
'dateWidget' => '{{year}}{{month}}{{day}}{{hour}}{{minute}}{{second}}{{meridian}}'
]);

@见http://book.cakephp.org/3.0/en/views/helpers/form.html#customizing-the-templates-formhelper-uses

关于CakePHP 3 : change order in dateWidget,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30876688/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com