dongqie4402 2016-10-04 13:41
浏览 34

如何在Cake PHP中只读日期输入字段

Is there any standard way of making the date input field readonly in CakePHP.

I have the following code:

echo $this->Form->input('testDate',array(
                            'label' => 'date',
                            'dateFormat' => 'DMY',
                            'minYear' => date('Y') - 20,
                            'maxYear' => date('Y') - 0
                        )
                    )

I have tried the following way:

echo $this->Form->input('testDate',array(
                            'label' => 'date',
                            'dateFormat' => 'DMY',
                            'minYear' => date('Y') - 20,
                            'maxYear' => date('Y') - 0,
                            'disabled' => 'disabled'
                        )
                    )

That works fine (make the input field diable) but ofcourse I can't POST, So I tried 'readonly' => 'readonly' instead of disabled at the same way and this is not working. Do I have to use any other way (ex. Javascript)? Where am I making mistakes? Thanks for all the suggestions

  • 写回答

1条回答 默认 最新

  • dozr13344 2016-10-11 16:50
    关注

    try this

    echo $this->Form->input('testDate',array(
                                'readyonly' => true
                            )
                        )
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分