Friday, 15 January 2010

how to add validation on date overlaps in grails -



how to add validation on date overlaps in grails -

i have domain class have field there 2 dates namely start date , stop date. have mysql database linked application. while entering details in webpage, need create sure date given not overlap older enteries in database.

my domain class defined below:

class assigned {

string assignedto = " " date assigneddate date expirydate string ownedby string additionalinformation = " " static constraints = { assignedto() assigneddate() expirydate() ownedby() additionalinformation() }

}

when press create in view, need validate no other things overlap current dates have given.

please help. thanking in advance..

if want check period between given start , end date other entries.

write method check each stored period - if start date greater equals stored start date , - if start date less equals stored end date

do end date.

in controller phone call method save/update method. if start or end date overlap period create validation failed message + redirect create/edit view.

grails

No comments:

Post a Comment