Hi folks,

firstly, thanks much for RIFE.  I am not a web developer, (mainly
server side java non-web apps). But finding web app development much
more pleasent than i expected using this framework, though I have yet
to try ROR or Grails.

moving on..

I have this constraint in my MetaData class for a date field:

       DateFormat formatter = new SimpleDateFormat("MM/dd/yy");

       ConstrainedProperty startDConstraint = new
ConstrainedProperty("start_date")
               .notNull(true)
               .notEmpty(true)
               .format(formatter)
               .autoRetrieved(true)
               .editable(true)
               .listed(true);
       startDConstraint.setDefaultValue(formatter.format(new Date()));
       addConstraint(startDConstraint);


When utilizing the CreateCrudStructureParticipant  to create the table
for the underlying POJO,  I get this error:


WARNING: The crud structure for
com.uwyn.rife.rep.participants.CreateCrudStructureParticipant4
couldn't be installed, it probably already exists : Error while
executing the SQL 'CREATE TABLE mytable (end_date DATETIME NOT NULL,
id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, start_date
DATETIME DEFAULT '09/16/06' NOT NULL, timestamp DATETIME DEFAULT
'2006-09-16 12:28:25.0' NOT NULL, PRIMARY KEY (id), CHECK (name !=
''))'.; Invalid default value for 'start_date'


I wanted to use setDefaultValue on my date field to simply fill-in a
default date abiding by "mm/dd/yy" format just for presentation
purposes. Obvioulsy the filed validation is set to use the formatter I
defined.  So I suspect what is happening is the validation on the Date
field using setDefaultValue is done at the model level rather at the
view level and hence a the error.

What is the best way to set the text of a date field  that is auto
generated by RIFE ?

regards
J.
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to