Grails

Property offeringDate must be a valid Date even if that field allows null

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.0.1
  • Fix Version/s: 1.0.4
  • Component/s: Scaffolding
  • Labels:
    None
  • Environment:

Description

I created a domain with a data field, set the constraints as nullable:true, on the generated create view you can select blanks for dates, but it gives you a validation error.

Property offeringDate must be a valid Date

Project will be attached to this bug.

Issue Links

Activity

Hide
Goran Ehrsson added a comment -

Same here. Tried with both nullable:true and blank:true. Same error.
Impossible to save a blank/null date.
The created database column allow null.

Show
Goran Ehrsson added a comment - Same here. Tried with both nullable:true and blank:true. Same error. Impossible to save a blank/null date. The created database column allow null.
Hide
Goran Ehrsson added a comment -

I added a workaround in my controller that converts blank to null for all dates in the params map. So I'm happy for now.

Show
Goran Ehrsson added a comment - I added a workaround in my controller that converts blank to null for all dates in the params map. So I'm happy for now.
Hide
Steve Tekell added a comment -
Show
Steve Tekell added a comment - this might be duplicate of http://jira.codehaus.org/browse/GRAILS-1793
Hide
Pam added a comment -

I'm still on 1.0.3, I just had to work around this in the controller. ended up having similar problems with references to other objects as well. Here's some sample code:

//handle some errors in grails 1.0.3 default binding
if(!params."defaultOperator.id" || params."defaultOperator.id"==""){ params.defaultOperator = null; params.remove(params."defaultOperator.id"); def old = network.defaultOperator; network.setDefaultOperator(null); //if I don't do this I get an unsaved transient reference error. old.save(); }
if (!params.networkStartDate_year || params.networkStartDate_year == ''){ params.networkStartDate = null; }
if (!params.networkEndDate_year || params.networkEndDate_year == ''){ params.networkEndDate = null; }
network.properties = params

Show
Pam added a comment - I'm still on 1.0.3, I just had to work around this in the controller. ended up having similar problems with references to other objects as well. Here's some sample code: //handle some errors in grails 1.0.3 default binding if(!params."defaultOperator.id" || params."defaultOperator.id"==""){ params.defaultOperator = null; params.remove(params."defaultOperator.id"); def old = network.defaultOperator; network.setDefaultOperator(null); //if I don't do this I get an unsaved transient reference error. old.save(); } if (!params.networkStartDate_year || params.networkStartDate_year == ''){ params.networkStartDate = null; } if (!params.networkEndDate_year || params.networkEndDate_year == ''){ params.networkEndDate = null; } network.properties = params

People

Vote (3)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: