-2
有沒有任何標準的方式使日期輸入字段在CakePHP中只讀。如何使日期輸入字段只讀在CakePHP
我有以下代碼:
echo $this->Form->input('testDate',array(
'label' => 'date',
'dateFormat' => 'DMY',
'minYear' => date('Y') - 20,
'maxYear' => date('Y') - 0
)
)
我曾嘗試以下方法:
echo $this->Form->input('testDate',array(
'label' => 'date',
'dateFormat' => 'DMY',
'minYear' => date('Y') - 20,
'maxYear' => date('Y') - 0,
'disabled' => 'disabled'
)
)
這工作正常(使得輸入域魔鬼),但ofcourse我不能發表,所以我嘗試了'readonly'=>'只讀'而不是以相同的方式禁用,這是行不通的。我必須使用其他方式(例如Javascript)嗎?我在哪裏犯錯誤?感謝所有的建議
試試這個 '回聲$這個 - >形式 - >輸入(' testDate '陣列( '標籤'=> '日期', ' dateFormat'=>'DMY', 'minYear'=> date('Y') - 20, 'maxYear'=> date('Y') - 0, 'readonly'=> true ) ); 「 –
嗨Rohit,我已經嘗試過,以及:( – modon
cake2或cake3?請檢查標籤 – arilia