0

我正在开发一个应用程序来跟踪会议的会话,并希望允许用户从下拉列表中选择日期,但将日期作为日期存储在 oracle 数据库中。我试过使用日期选择器,但想限制选项。这是我目前正在使用的代码。

<g:select name="sessionDate" from="${session_MasterInstance.constraints.sessionDate.inList}" value="${formatDate(format:'mm/dd/yyyy', date:session_MasterInstance?.sessionDate)}" noSelection="['null': '']" />

我要显示的值确实显示正确,但是当我尝试创建新记录时,我收到Propery sessionDate must be a valid Date

sessionDate(nullable:true, inList:["11/21/2011","11/22/2011"])的 Oracle DB 中有我的域类和日期格式的 sessionDate。

请指教。我是 grails 的新手,所以这可能很简单。

4

1 回答 1

0

It might be this issue: GRAILS-6604 (there's a workaround there for pre-1.3.6).

What Grails version are you using?

I'm in doubt about inList that contains Strings for values. If this constraint produces errors, I'd try inList: [new Date(2011, 11, 21), new Date(2011, 11, 22)].

于 2011-08-03T22:07:23.353 回答