Silverstripe 如何通过自定义表单模板在日期字段上使用日历?
我按照说明 这里。
但是,我在向日历添加日期字段时遇到问题。通常我只是做这样的事情:
$dateField = new DateField ('DateRequired', 'Date Required');
$dateField->setConfig ('showcalendar', true);
我已经在自定义表单中尝试了上述代码,但是该页面不包含日历字段的任何 jquery ui 脚本或 css 文件。
所以我的问题是如何让我的自定义表单包含所有脚本并使用 jquery ui 日历呈现字段?
I have created a custom form class and template for my form by following the instructions here.
However I am having trouble with adding DateFields with calendars. Usually I just do something like this:
$dateField = new DateField ('DateRequired', 'Date Required');
$dateField->setConfig ('showcalendar', true);
I have tried the above code in my custom form however the page doesn't include any of the jquery ui scripts or css files for the calendar field.
So my question is how can I get the my custom form to include all the scripts and render the fields with the jquery ui calendars?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上模板的改变是没有必要的。
actually the change of the template should not be necessary.
好吧,我已经解决了。模板中调用字段的代码需要从: 更改
为:
现在所有 javascript 都包含在页面中。
Ok I have worked it out. The code within the template that calls the fields needs to be changed from:
to:
Now all of the javascript is included within the page.