Silverstripe 如何在带有自定义表单模板的 DateFields 上使用日历?

标签 silverstripe

我已经按照说明 here 为我的表单创建了自定义表单类和模板.

但是我在添加带有日历的 DateFields 时遇到了问题。通常我只是做这样的事情:

$dateField = new DateField ('DateRequired', 'Date Required');
$dateField->setConfig ('showcalendar', true);

我已经在我的自定义表单中尝试了上述代码,但是该页面不包含日历字段的任何 jquery ui 脚本或 css 文件。

所以我的问题是如何让我的自定义表单包含所有脚本并使用 jquery ui 日历呈现字段?

最佳答案

其实模板的改变应该是没有必要的。

$dateField = new DateField('...');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('showdropdown', true);
$dateField->setConfig('dateformat', 'dd.MM.YYYY');

关于Silverstripe 如何在带有自定义表单模板的 DateFields 上使用日历?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8653443/

相关文章:

content-management-system - silverstripe 3 addFieldToTab "Settings"

Silverstripe::多站点树

testing - Silverstripe 测试无法从夹具中找到页面

silverstripe - 如何自定义 SilverStripe 页面的 <title>

银条。已上传直播。获取 "SilverStripe Framework requires a $databaseConfig defined."

if-statement - 模板中的 SilverStripe 条件

.htaccess - 如何将我的 Silverstripe 网站的子页面显示为子域?

php - MySQL FROM 多个表 LEFT JOIN 'on clause' 中的未知列

filter - SilverStripe 3.1.x - DataList唯一字段值过滤器/如何使用ORM对分组列表中的项目进行计数?

.htaccess - Silverstripe mod_rewrite 问题(我认为)